How can I send attachment information to sendmail

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);          

themail.class contains two parts:
one themail--Loads the application configuration files
two sendmail--builds the emails and sends it.
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.
TOTAL CODE FOR THEMAIL:
As you can see from below:
package com.checkpoint.mail;
import java.beans.*;
import java.util.*;
import java.io.*;
//import javax.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class theMail implements Serializable {
     private static Properties configProperties = null;
     private static String logFileName = "";
     private static String ipLogFileName = "";
     public static SimpleDateFormat datefmt = new SimpleDateFormat ("dd/MMM/yyyy:HH:mm:ss");
     public void init() throws ServletException {
     //String configPropertiesFile
     // = getServletConfig().getInitParameter("configPropertiesFile");
     //configPropertiesFile
     // = (configPropertiesFile == null)?("/export/home/verity/custom/jsp/mail/config.properties"):(configPropertiesFile);
     //System.setProperty("configPropertiesFile",configPropertiesFile);
     // Application Configuration properties
     try {
     loadApplicationConfiguration();
     catch(Exception e) {
     throw new ServletException("error loading configuration",e);
     private void loadApplicationConfiguration() throws IOException {
     // read from properties file so the code need not change
     configProperties = new Properties();
     File configPropertiesFile
     = new File(System.getProperty("configPropertiesFile","/export/home/verity/custom/jsp/mail/config.properties"));
     configProperties.load(new FileInputStream(configPropertiesFile));
     logFileName = getLogFileName("");
     ipLogFileName = getIPLogFileName("");
     private String getLogFileName(String def) {
     String value = configProperties.getProperty("logfilename", def);
     return value;
     private String getIPLogFileName(String def) {
     String value = configProperties.getProperty("iplogfilename", def);
     return value;
     public void sendEmail (String mailServer, String subject, String to[], String from, String messageText, String[][] filenames)
          throws AddressException, MessagingException
          String logMessage = "";
          String dateTime = "";
          dateTime = datefmt.format(new Date());
          logMessage = from + ":" + subject + ":" + messageText + ":" + "X";
          writeLog(logMessage);
          // Create session
          Properties mailProps = new Properties();
          mailProps.put("mail.smtp.host", mailServer);
          mailProps.put("mail.debug","true");
          Session mailSession = Session.getDefaultInstance(mailProps, null);
          // Construct addresses
          int toCount = to.length;
          InternetAddress[] toAddrs = new InternetAddress[toCount];
          for (int i=0; i<toCount; ++i)
               toAddrs[i] = new InternetAddress(to);
          InternetAddress fromAddr = new InternetAddress(from);
          // Create and initialize message
          Message message = new MimeMessage(mailSession);
          message.setFrom(fromAddr);
          message.setRecipients(Message.RecipientType.TO, toAddrs);
          message.setSubject(subject);
          // create and fill the first message part
          MimeBodyPart mbp1 = new MimeBodyPart();
          mbp1.setText(messageText.toString());
          // create the Multipart
          Multipart mp = new MimeMultipart();
          // add text first
          mp.addBodyPart(mbp1);
          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);
          // add the Multipart to the message
          message.setContent(mp);
          // Send message
          Transport.send(message);
     public static void writeLog(String logMessage) {
          try {
          FileWriter ofile = new FileWriter(logFileName, true);
          BufferedWriter obuff = new BufferedWriter(ofile);
          obuff.write(logMessage);
          obuff.newLine();
          obuff.close();
          } catch (IOException exc) {
          System.out.println(exc);

Similar Messages

  • How can I send a text with a picture attachment on my new iPhone5c?

    How can I send a text with a picture attachment on my new iPhone5c? It won't send or recieve!!.

    Does your carrier support it?
    Follow the steps in this guide.
    http://www.imore.com/how-send-photo-using-imessage

  • How can I send pictures not embedded, but as an attachment? THX

    How can I send pictures not embedded, but as an attachment? THX

    I had the same problem. I closed  the message, tried again selecting the correct imessage contact number and it worked.
    I'm guessing I first selected a non-imessage phone number and it got stuck in a gray/can't send mode (bug).

  • How can I send a .pdf attachement using maildemo_sql.txt

    Hi
    I have created a PL/SQL package using the following link.
    Could you plese tell me how can I send a .pdf as an attachement using the follwing package?
    http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/maildemo_sql.txt
    regards

    When using the "MailDemo" package, in order to send email attachements, the document you attach MUST reside on the Database Server or UTL_SMTP or UTL_MAIL Oracle packages won't be able to find the file. I recommend you define a location (directory) on the database server file system where all email attachements must be stored and reference this location using an Oracle Directory object. You will need to modify the BEGIN_ATTACHMENT procedure to add the file location referenced by the Oracle Directory object to the filename parameter. For example:
    /* Create the Oracle DIRECTORY */
    CREATE OR REPLACE DIRECTORY FILE_ATTACHMENTS as '/temp/attachments/';
    /* Modification to MAILDEMO */
      PROCEDURE begin_attachment(conn         IN OUT NOCOPY utl_smtp.connection,
                        mime_type    IN VARCHAR2 DEFAULT 'text/plain',
                        inline       IN BOOLEAN  DEFAULT TRUE,
                        filename     IN VARCHAR2 DEFAULT NULL,
                        transfer_enc IN VARCHAR2 DEFAULT NULL) IS
      BEGIN
        write_boundary(conn);
        write_mime_header(conn, 'Content-Type', mime_type);
        IF (filename IS NOT NULL) THEN
           IF (inline) THEN
           write_mime_header(conn, 'Content-Disposition',
             /* 'inline; filename="'||BFILENAME('filename||'"'); */ /* Line BEFORE */
               'inline; filename="'||BFILENAME('FILE_ATTACHMENTS',filename)||'"'); /* Line AFTER */
           ELSE
           write_mime_header(conn, 'Content-Disposition',
             /* 'attachment; filename="'||filename||'"'); */  /* Line BEFORE */
               'attachment; filename="'||BFILENAME('FILE_ATTACHMENTS',filename)||'"');  /* Line AFTER */
           END IF;
        END IF;
        IF (transfer_enc IS NOT NULL) THEN
          write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);
        END IF;
        utl_smtp.write_data(conn, utl_tcp.CRLF);
      END;If you have to send the file attachment from the User's workstation, then I suggest you either add the ability to FTP a file from a users workstation to the Database Server; use a javabean to send email directly from the client workstation or use WebUtil to open an Outlook message and attach the file using Outlook. I personally prefer using the database package to send email because you have a central point that all processes use and that makes the process easier to maintain. If you opt to try the Java Bean or WebUtil options, here are some great links that work really well also.
    Java Option:
    Send email with html body and local file attachments
    WebUtil Option:
    Sending Email via Outlook via forms
    Re: Sending email from Oracle Forms with attachments
    I cannot confirm the WebUtil options work as I have not tested these myself, however, I have tested the Java option and it works fine.
    Hope this helps,
    Craig B-)
    If a response is helpful or correct, please mark it accordingly.

  • HT2508 My amp has an USB input but when I attach my mac pro to it, and set the input to the USB setting, no sound comes out. I looked at the system settings, but none of them produce a different outcome. How can I send the music through the USB out to USB

    My amp has an USB input but when I attach my mac pro to it, and set the input to the USB setting, no sound comes out. I looked at the system settings, but none of them produce a different outcome. How can I send the music through the USB out to USB in?

    AFAIK cameras offer their own built-in format utility for inserted SD cards.  You should use that.  Otherwise, refer to the manual that came with your camera to determine precisely how your SD cards need to be formatted to work properly.  Personally, I'd suggest Partition Scheme: MBR, and Filesystem: FAT32.
    Try to limit the number of formats you perform on the SD cards, though, as you're reducing their lifespan.  I believe formatting causes re-writes to a portion of the SD card that has fewer read/write cycles than the rest of the card as a whole.

  • How can I send e-mail with attachment from oracle 10g?

    How can I send email with attachment from oracle 10g?

    hi you can achieve the same thing from database tier of unix.

  • HT1541 It doesn't appear the send gift window, it pops up the card selection. How can I send a gift without entering card information if I have credit in my coconut?

    Can't send a gift even if I have credit in my account, it asks me to enter a visa o MasterCard number, how can I send a gift without giving this info.

    You cannot gift with a gift balance.  You must use cc to gift

  • How can we send Error Idocs via mail

    Hi,
    I have read read through forums and  understood that it can be achieved either through workflow or through report using table edidd & edids.
    If workflow option is used , does the mail trigger for every error idoc ? How can we send daily error report to user say by EOD containing all error idocs using all possible options.
    Regards,
    Rachel

    Rachel,
    I dont think so any direct Report will be available just to get Error IDOCs details. Although you can create a simple report to read the tables. An example is in below link.
    http://wiki.scn.sap.com/wiki/display/Snippets/Custom+report+for+IDOC+Monitoring
    Also, you can create a Query of EDIDC and EDIDS tables to obatin relevant information.
    Thanks,
    Ravi

  • How can I send more than one document on an email

    how can I send more than one document on one email

    Thank you but I understand that form of attaching a document. However when I select a document then click 'Share' I have the option of sending the document by email as a word or pages document or pdf, what I want to know is can I use this procedure to send more than one document per email and if I can how?

  • How can i send video from my iphone 4s to email

    How can i send video from my i phone 4s to an email address?

    Mail attachment size is determined by your ISP, & limit that size to betweem 10MB's & 25MB's, depending on ISP. So, unless it is a very small video, you won't be able to.

  • How can i receive the information from a form ?

    I created a form in Dreamweaver CS5 with some input fields and with a send button.
    The question is how can I receive the information that is filled in by the visators.
    Where can I tell to which email adress the information has to be send. Where can I find this in dreamweaver CS5?
    Or what else do I have to do before a form is actually working and I'm receiving the input?
    Already thanks
    Ron

    I'm just starting with building a site
    so thanks for this email
    2010/11/17 DeonH <[email protected]>
    Hi there.
    >
    I don't know what your capabilities are regarding coding. I am no
    programmer and use "Forms to Go" with much success. Take a look here:
    http://bebosoft.com/products/formstogo/overview
    >
    Regards,
    Deon
    >

  • Using action script 2 how can i send a variable value to a dynamic textbox on a different keyframe?

    using action script 2 how can i send a variable value to a dynamic textbox on a different keyframe?

    Thanks for your swift response.
    That sounds like a good solution, but the code I have on frame 2 is this
    timer = 0;
    countup = function(){
    timer++;
    countupInterval = setInterval(countup,100);
    If I added the same actionscript to frame 3 which has a dynamic textbox with a variable timer attached wouldn't it just put the timer back to 0? What I want is the last known value that was given when it was in frame 2.
    I am thinking of temple run here, I am trying to caculate the total distance(set in the timer variable) from the previous try.
    Hope this makes sense.
    Chazwick

  • How can I send a document in iworks as a pdf file?

    How can I send a document in iworks as a pdf file?  My friends who have windows are not able to open any attachment I send them.  Very frustrating.

    Click 'Print' - then in the dialogue window in the bottom left, select save as PDF.
    Done!

  • How can I send a large pdf file (42MB) attachments by icloud ??

    How can I send a large pdf file (42MB) attachment by email in Icloud ???

    That's a bit excessive.  The website http://convert.neevia.com/pdfcompress/ can compress files up to 5 MB in size. You may want to print to PDF single smaller pages, or print the document and scan it one page at a time to PDF, and then use the PDF compress tools to shrink it further.

  • How can i send emailed PDF's directly to my iPad iBooks rather than have them sitting in my inbox unorganized...

    I had hoped that my PDF's in my iPhone iBooks would automatically also go to my iPad iBooks without the need for syncing. Is there some setting to make that happen?
    If that is not an option, how can I send my emailed PDF's directly to my iPad iBooks; I no longer want them sitting in my email folder since there is no way to organize the content of the email folders and I am looking for a way to organize this information that I need to be able to quickly retrieve.

    Thank you for your rapid reply! Yes, I was able to move them from my email to iBooks on my iPhone in this way, but the same method did not work for the iPad . I was really hoping for some super simple solution... thanks for your comment though

Maybe you are looking for

  • Item Category determination in Sales Order

    Hi How to know, how item category determined in Sales Order.  Is there any analysis available in Sales Order level, similar to output or text determination. Problem here is in a particular sales order, item category is different compared to configura

  • Can't get sound through my speakers in Logic.

    So for an assignment I recorded loads of stuff in the studios at uni and come back to mix it on Logic on my laptop and I can't seem to get any sound out from my speakers through logic. Speakers are working cause I'm listening to iTunes. I don't know

  • ITunes Music has no volume

    I recently installed iTunes on my HP Media Center PC and using EZ Vinyl Converter, created a file with album tunes. When playing the tracks in iTunes, I see the progress bar, but there is no volume. None of my volume controls is on mute. Suspect inco

  • AP. Adjusting Selected Invoices for Manual Payments

    Hi We have the problem when Adjusting Selected Invoices for Manual Payments: The system does not prevent user from the adjusting invoices on cleared payments, though in Oracle Payables User Guid is said: "You cannot adjust invoices on a cleared payme

  • Display messed up on some Websites

    There are a lot of websites that the page layout is not correct with over lapping headers, menus, etc. This happens even on apples website. I can fix it by enlarging the layout by hitting apple + keys a few times but when I do this the resolution get