Sending attatchments....

hi all,
Im developing a webmail and i've seen on the net about how to send an attatchment in mail..i found this.....
     try {
     String text="This is the file attachment";
     // create a message
     Message msg = new MimeMessage(mailsession);
     Address fromAddress=new InternetAddress(from);
     // set the from
     msg.setFrom(fromAddress);
     InternetAddress[] address ={new InternetAddress(to)};
     msg.setRecipients(Message.RecipientType.TO, address);
     msg.setSubject(subj);
     MimeBodyPart textPart = new MimeBodyPart();
     textPart.setContent(text, "text/plain");
     File f = new File(filename);     
     MimeBodyPart attachFilePart = new MimeBodyPart();
     FileDataSource fds = new FileDataSource(f);
     attachFilePart.setDataHandler(new DataHandler(fds));
     attachFilePart.setFileName(fds.getName());
     Multipart mp = new MimeMultipart();
     mp.addBodyPart(textPart);
     mp.addBodyPart(attachFilePart);
     msg.setContent(mp);
     Transport.send(msg);
     out.println("Your attachment has been sent successfully");
     catch (Exception e)
          System.out.println(e);
but this is code tries to send the files from the server wright... so before sending a mail with attatchments...we need to upload the file to the webserver and then send the email with attatchment...so i just want to know is this wright way of sending mails with attatchments...
any inputs on this..
kiran

Hi
You can use jspUpload component to upload a file to server and store it in a particular directory.
Then use any attachment program to read this file by pasing file path and send an attachement.
It is quite simple , is'nt it?
Have fun..

Similar Messages

  • Receiver Mail Adapter sending Attatchments to dynamic recipients

    Hi,
    I am using a Receiver Email Communication Channel. I need to be able to send emails to dynamically assigned recipients. I know I need to use the 'Use Mail Package' option. I am doing this and it is working. However, I also need to attatch the payload to the email. This will work by not specifying the 'Use Mail Package' option. I need to do both.
    I can send an email with an attatchment. But the content of this attachment has been generated by a Message Mapping. I want the payload on the attchment.
    Thanks
    Martin

    Hi Martin,
    when you use the Mail Package format and assign your payload to the <Content> Element, it should be send as an attachement.
    <?xml version="1.0" encoding="UTF-8"?>
    <p2:Mail xmlns:p2="http://sap.com/xi/XI/Mail/30">
    <Subject>My Mail</Subject>
    <From>[email protected]</From>
    <To>[email protected]</To>
    <Content_Type>text/xml;name="MyContent"</Content_Type>
    <Content>...</Content>
    </p2:Mail>
    Hope this helps
    Thomas

  • Cannot properly send attatchments

    Hello,
    I recently purchased a new 13" Macbook Pro, and until recently I had no problem sending emails with attachments. However, I seem to now have an issue with properly sending attachments.
    I am able to attach at file (usually .doc .docx and .pdf) and send it, however, the recipient(s) of my email can sometimes not open these files. I know that it is not an issue of their programs because it happens to many of my contacts, even when they have Microsoft Word 2008/2007/2010. Is there anything that I am doing wrong or is there a setting that I need to fix. If so what can I do to fix it?
    Thanks for any help you can provide!
    TJRas

    Are you checking "Send Windows Friendly Attachments" when adding them?

  • After installing lion I get"Attachment Id has bad format" when trying to send an attachment in Hotmail.  Any ideas

    After installing the new lion, I can no longer send attachments in my hotmail account, I get "attachment Id has bad format". Any ideas?

    THANK YOU !!! THANK YOU !!!
    I took the time to actually set up and sign in to be able to say thankyou for the info - my Apple techs up hear in the North had NO clue on how to solve my problem - sending attatchments is my business and I was out of it since Oct. 14th
    THANK YOU AGAIN - IT WORKED PERFECTLY JUST HOW YOU SAID

  • Problem sending mail with ATTATCHMENTS

    hi all,
    Im doing something like this to send a mail with attatchments:
         msg.setRecipients(Message.RecipientType.TO, address);
         msg.setSubject(subj);
         MimeBodyPart textPart = new MimeBodyPart();
         textPart.setContent(text, "text/plain");
         File f = new File(filename);     
         MimeBodyPart attachFilePart = new MimeBodyPart();
         FileDataSource fds = new FileDataSource(f);
         attachFilePart.setDataHandler(new DataHandler(fds));
         attachFilePart.setFileName(fds.getName());
         Multipart mp = new MimeMultipart();
         mp.addBodyPart(textPart);
         mp.addBodyPart(attachFilePart);
         msg.setContent(mp);
         Transport.send(msg);
    this is working for the first time........
    if I execute this for the second time.... my attatchments are visibile inside the message..... something like this...
    ------=_Part_28_1086341.1034758766530
    sd
    <br>fa
    <br>sdf
    <br>sd
    <br>
    ------=_Part_28_1086341.1034758766530
    Content-Disposition: attachment; filename="2day's Work.txt"
    Today's tasks done:
    OCR conversion for the following:
    1) pages rescaned in 12th class part A.
    2) pages 61- in 12th class part C.
    ------=_Part_28_1086341.1034758766530--
    it is showing the attatchment content inside when i run the same code for the second time....
    anyone can help me out!!!
    thax in adv,
    kiran

    yup.. it worked navaz.....
    thx a lot... may i know whatz happening here...
    thx again...
    kiran

  • Sending e-mails with large attatchments...

    Hello, I just bought a new iMac and I'm switching from PC. I'm trying to send some pictures to my friends through iPhoto and Mail but Port 25 keeps timing out the outgoing server so I can't e-mail the picture. Is there a way that I can increase the time of the outgoing server before it times out?

    Click here for information.
    (24834)

  • Sending email with attatchements

    hi everyone,
    Im having difficulties sending an email with an attatchment. Basically what im trying to do is send a web pages HTML along with 2 pdf files. The html i send should result in the email looking like a webpage with 2 files added as attatchments. Ive looked at sample code but basically i am i cant get it to work. If someone has sample code or has a web link showing how to do so that would a a lot of help.
    thanks

    it's very easy using javamail api .
    In the Following link sedn code has been given .
    http://www.javacommerce.com/articles/sendingmail.htm
    i hope it will help you .
    Sanjay

  • PDF Software causing problems in sending some PDF files but not all?

    I have been having problems sending some emails with PDF attatchments, they are being returned more and more frequently.  I've spoken to our server host and his answer is as follows saying that the problem is we are using "cheap PDF software" which is why I can send PDF's via Gmail or Yahoo but not through our server.  He suggest we buy a more expensive software or using Gmail for our important bids and invoices that are sent daily.
    My question is:  Is this even close to what could be causing the problem.  We are using Adobe to create our PDF's using our HP CM1410 or the Neat Scanner.  The Neat is a new device but the problem was ongoing before the Neat Scanner was added.
    Our IT person who set our network, hardware and software says it's the server and he's never heard of this being an Adobe problem.  So we're stuck not knowing who to believe

    There are several potential problems. It could be that your e-mail client is not encoding the PDF properly, but looking at it as an ASCII file (7-bit characters). The encoding is not as much of a problem anymore, but still a potential issue. The structure of the PDF that you are getting from the scanner may be corrupt. You can use some of the preflight scripts to check the integrity of the PDF. You might even try saving as a new PDF to see if the 2 versions work differently.
    It might be better to print the proposals you mentioned to the Adobe PDF printer and get better quality proposals than you would get with a scan. That would also probably avoid the problem you are having.

  • Ringtones and attatchments

    Ok, chances are this has been asked before as i'm a new user of the i-phone, sorry if it has.
    How do i get a none i-tunes ringtone onto my phone, I recently downloaded 2 soundbites, 1 for a ringtone and 1 for a message tone, so how do I get them to work as ringtones and message tones.
    Secondly, how do I send an attatchment, there is no option given to either bluetooth to another phone or add attatchments to e-mails.
    I'm giving it untill tuesday then the phone will go back if it won't do what I want it to do.
    Thanks,
    Martin.

    You can use Google to find out how to make ringtones for iphone out of most any sound file.
    You CANNOT make a custom text sound/message sound. This is not a feature of iphone.
    You cannot add attachments (as you cannot store files on iphone)or use bluetooth to transfer files. You can forward an e-mail with attachment. You can e-mail pics.
    http://manuals.info.apple.com/enUS/iPhone_UserGuide.pdf

  • Internet attatchments help - i have deleted something and unsure what?

    Hi,
    i had problems with my new blackberry 9630 scrolling down while on internet broswer.
    - while looking for help on the internet i followed steps telling me to delete thing in my service book.
    - that problem is now fixed (not through the deleting but something else!!)
    I think i have deleted something i shouldnt as now when i am on twitter i cant click on attatchments people have tweeted such as pictures or links etc?
    anybody help?

    Hi and Welcome to the Community!!
    It sounds like you did part, but not all, of this important process. I therefore suggest the following steps, in order, even if they seem redundant to what you have already tried (steps 1 and 2 each should result in a message coming to your BB...please wait for that before proceeding to the next step):
    1) Register HRT
    KB00510 How to register a BlackBerry smartphone with the wireless network
    Please wait for one "registration" message to arrive to your Messages app
    2) Resend Service Books
    KB02830 Send the service books for the BlackBerry Internet Service
    Please wait for "Activation" Messages, one per already configured email account, to arrive in your Messages. If you have no already configured email accounts, please wait 1 hour.
    3) Batt Pull Reboot
    With power ON, remove the back cover and pull out the battery. Wait about a minute then replace the battery and cover. Power up and wait patiently through the long reboot -- ~5 minutes. See if things have returned to good operation. Like all computing devices, BB's suffer from memory leaks and such...with a hard reboot being the best cure.
    Hopefully that will get things going again for you! If not, then you should contact your mobile service provider for formal support.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Cannot send email from iPad2 with Shaw

    Hi there,
    I have issues that I cannot seem to resolve:
    I can receive from my shaw account but it sends all outgoing to the Outbox - I've double, triple cheked all incoming and outgoing servers - I even sat with my iPad next to my iMac to make sure everything matched.
    it says  The sender address "myemailadrees.com" was rejected by the server. even though I recive ok.
    Help please??

    I too have spend countless hours trying to get my iPad 2 to work with my Shaw email.  I FINALLY got it to work this morning after about 3 months of trying different "solutions".  Here is how I set my POP email account:
    Incoming mail server:
    Host name:  shawmail.ed.shawcable.net (I live in Edmonton)
    User name: my shaw email address without the @shaw.ca
    Password: my Shaw email password
    Outgoing mail server:
    Host name:  shawmail.ed.shawcable.net (I live in Edmonton)
    User name: leave blank
    Password: leave blank
    Use SSL: off
    Server port: 25
    This has worked so far for me, so hopefully it will work for others as well.  It seems like there is an lot of people on these forums going through the same frustrations.  I was able to set both mine and my wife's email accounts on my iPad.

  • I click on itunes but doesnt open and says send error report or dont send

    i click on itunes but doesnt open and says send error report or dont send

    You will need to provide more details as we cannot see your computer screen. Does this happen every time you launch LabVIEW? What version of LabVIEW are you using? What version of Windows? Does LabVIEW crash? If so, what were you doing at the time it crashed?

  • How can I disable sending from one Mail account?

    Hello. I have a gmail account that I use to subscribe to various newsletters and accounts. So it's essentially a read-only account for me. But I too frequently accidently send mail from that account. Is there a way to prevent mail from being sent from that account?

    I want to do the same thing as the OP.  I have tried making outgoing server none. And checking "always use this server so it prompts me to edit the message so that I manually select a different address to send from inthe drop down list. And selecting a different account for composing.  Actually, all my outgoing emails keep coming from the one account I am attempting to disable.  Got any other ideas?

  • When i send a PDF via e-print, it gets cropped, is there a way to prevent this from happening?

    PDF's are printing fine when i print direct to the printer but when they are sent by e-mail they get cropped, is there a way to get the document to fit to page when sent as an email attachment?
    The Printer in question is a HP LaserJet Enterprise 500 color M551n, the printer is brand new installed last week so i don't know if this is the norm or not.
    Edit: Please can someone please explain how to correct this.

    If you're using a desktop or notebook PC to send the email you could try installing the HP ePrint Mobile Driver software on your machine, the link to the download is here. This will allow you to print the PDF to any ePrint capable printer without having to email it to the printers email address as an attachment.
    Once installed and with your PDF open on your machine, select Print from the File menu, then select "ePrint" from the list of available printers (don't select the actual printer itself) and click Print in the bottom right corner of the box. A dialogue box will open showing the avaialble ePrint printers you can print to. Click on the Connected button on the left of the screen to add your printer to the list if its not listed.  
    Hope this helps.
    If my reply helped you, feel free to click on the Kudos button (hover over the "thumbs up").
    If my reply solved your problem please click on the Accepted Solution button so other Forum users may benefit from viewing the post.
    I am an HP employee.

  • Filename in sender Mail Adapter

    Hi Experts,
    Brief about Scenario:
    Invoice generated with PDF format in R/3 system and send to  mail box.  XI  pick that file from mail box  and deposited in SFTP Server.   
    Landscape in XI end.
    Mailbox - - -  XI 7.0 - - - SFTP
    The file name generated with CompanyCode_InvoiceType_InvoiceNumber.PDF from R/3 system. So that Same file name should be deposited in SFTP Server  . Here CompanyCode and InvoiceType are static and invoiceNumber generated dynamically with PDF format.
    My question is How to get file name from mail box.
    Thanks in advance.

    Hups. I forgot what was your main problem
    To get attachment file name you can try to implement you own adapter module as described [here|http://wiki.sdn.sap.com/wiki/display/XI/Adapter%20Module%20PI%207.0%20Get%20Attachment%20Name?bc=true]:
    I found it in this [thread|Need to get the Mail attachment name as it is to the receiver file adapter;.
    Please check that thread. The question is "not answered" but the last post states it was solved that way.

Maybe you are looking for

  • Add a jar file to an Applet

    Hi all, I'm trying to add a .jar file to my applet using the code: <applet name=myApplet.class archive=model.jar></applet> Both the .class and .jar files are in the same directory as test.html So, when the applet starts an exception is thrown: java.l

  • Time machine died!! - plz help

    My time machine has died. No light. Thought it was the fuse which I have replaced. What are my options? Brought from Apple 1TB Feb 2009. Have I lost my backups? please help Ash

  • Will not update apps

    My iPhone 5 will not update app's. It say installing but it will not, HELP

  • IMac won't boot after ram upgrade

    For some reason, my iMac late 2013 3.4Ghz quad core i5 won't boot with new ram modules added.  New ram is exact same specs as original that came with the iMac.  I've tested the new ones on their own in the iMac, and the system boots up fine.  Same go

  • General Thought on Galaxy Nexus

    Moved for greater exposure