The_mail: Loads the application configuration files:

Send Mail:
public void sendEmail (String mailServer, String subject, String to[],
String from, String messageText, String[][] filenames)

I have the parameters in the right order, I am just not sure how to format
the (String[][] filenames) so the sendmail will accept it.

The error is occurring right here, (String[][] filenames),I am just not sure
what needs to be done to correct it.

This is where I attach the attachment:


                if (filenames != null)
                {
                    // create attached file part
                        for (int x=0; x<filenames.length; x++)
                        {
                                String fv_name = filenames[x][0];

                            MimeBodyPart mbp2 = new MimeBodyPart();

                                // attach the file to the message
                                FileDataSource fds = new FileDataSource(fv_name);
                                mbp2.setDataHandler(new DataHandler(fds));
                                mbp2.setFileName(filenames[x][1]);

                                mp.addBodyPart(mbp2);
                        }
                }






-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API
Technology. [mailto:SERVLET-INTEREST@;JAVA.SUN.COM]On Behalf Of Milt Epstein
Sent: Wednesday, October 30, 2002 5:43 PM
To: [EMAIL PROTECTED]
Subject: Re: How can I send attachment information to sendmail

On Wed, 30 Oct 2002, Lance Prais wrote:

> I am trying to allow users to upload files from my web site and then
> send me an email with the attachment.  I am able to upload the files
> to my server but I am having problems including the attachments with
> my
>
> The code is simple, I just cannot seem to make the connection and make it
> one step.
>
> Here is my code:
> <%
> FileUploadBean.doUpload(request);
> out.println("Filename:" + FileUploadBean.getFilename());
> out.println("<BR>Content Type:" + FileUploadBean.getContentType());
>         String mailServer = "";
>       String attachment = FileUploadBean.getFilename();
>         String [] to = {""};
>         //String [] to = {""};
>         String from =  "";
>         String subject = "";
>         String body = "";
> subject = "Document Request";
>       body = "Testing attachment\n\n";
>         body = body + "test: " + attachment + "\n\n";
> the_mail.sendEmail (mailServer, subject, to ,from, body, attachment);
>    %>
>
> email and am getting the follow error:
>
> org.apache.jasper.JasperException: Unable to compile class for
>
JSP/usr/local/netscape/server4/https-kb-dev/config/../ClassCache/_jsps/_test
> _post_jsp.java:159: Incompatible type for method. Can't convert
> java.lang.String to java.lang.String[][].
> the_mail.sendEmail (mailServer, subject, to ,from, body, attachment);

This looks like a pretty straightforward and informative error
message, what's the problem?  It looks like you don't have the
parameters in the right format.  What is the_mail, and what is/are the
signature(s) of its sendEmail method?

Milt Epstein
Research Programmer
Integration and Software Engineering (ISE)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to