Send email in html format

Hello everybody,
First of all:
I already searched via internet but couldn´t found an example which helped me to solve my problem. Anyway I believe it must be very simple what I want to do.
My Problem: I want to send an email in html format, but until now everything I tried didn´t worked. Please help me. What do I have to do?
I already tried a lot of code typing. For example this one:
this.resolveNode("#event").submit.target="mailto:"+email_adressen+"subject="+subject+"&Body="+body+"&MessageFormat=HTML";
But nothing is working, you always see the html tags in the text - they have no effect at all :-( .
Best regards,
Paolo

I was trying to do the same thing...I found this on the java.sun.com website somewhere. Hope it works out for you.
try {
String host = "";
String from = "";
String to = "";
String fileAttachment = fileName;
// Get system properties
Properties props = new Properties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
Session session1 =
Session.getInstance(props, null);
// Define message
MimeMessage message =
new MimeMessage(session1);
message.setFrom(
new InternetAddress(from));
message.addRecipient(
Message.RecipientType.TO,
new InternetAddress(to));
message.setSubject("");
// create the message part
MimeBodyPart messageBodyPart =
new MimeBodyPart();
//fill message
messageBodyPart.setText("");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source =
new FileDataSource(fileAttachment);
messageBodyPart.setDataHandler(
new DataHandler(source));
               messageBodyPart.setFileName(fileAttachment);
multipart.addBodyPart(messageBodyPart);
// Put parts in message
message.setContent(multipart);
// Send the message
Transport.send( message );
}catch (Exception e){
System.err.print("Mailing error:");
System.err.println(e);

Similar Messages

  • Send Email in HTML Format with Javamail.

    GOD BE BLESSED!
    Hello dudes,
    i create a jsp page let me send emails from a database using the API Javamail.
    But these emails when i send then, goes in text format only, and i want to send emails in HTML format too. Anyone can help me?
    I think the Javamail API can send in HTML format.
    thanks and sorry, my english is basic but i think you understand. ;)
    Adler Medrado

    I was trying to do the same thing...I found this on the java.sun.com website somewhere. Hope it works out for you.
    try {
    String host = "";
    String from = "";
    String to = "";
    String fileAttachment = fileName;
    // Get system properties
    Properties props = new Properties();
    // Setup mail server
    props.put("mail.smtp.host", host);
    // Get session
    Session session1 =
    Session.getInstance(props, null);
    // Define message
    MimeMessage message =
    new MimeMessage(session1);
    message.setFrom(
    new InternetAddress(from));
    message.addRecipient(
    Message.RecipientType.TO,
    new InternetAddress(to));
    message.setSubject("");
    // create the message part
    MimeBodyPart messageBodyPart =
    new MimeBodyPart();
    //fill message
    messageBodyPart.setText("");
    Multipart multipart = new MimeMultipart();
    multipart.addBodyPart(messageBodyPart);
    // Part two is attachment
    messageBodyPart = new MimeBodyPart();
    DataSource source =
    new FileDataSource(fileAttachment);
    messageBodyPart.setDataHandler(
    new DataHandler(source));
                   messageBodyPart.setFileName(fileAttachment);
    multipart.addBodyPart(messageBodyPart);
    // Put parts in message
    message.setContent(multipart);
    // Send the message
    Transport.send( message );
    }catch (Exception e){
    System.err.print("Mailing error:");
    System.err.println(e);

  • Send Email with HTML format in Outlook Macro

    I can use the following to send email with HTML format in VBA. I also have created an HTML file. Is there a way to load the file into .HTMLBody to send it as HTML format message?
        Set OutlookApp = CreateObject("Outlook.Application")
        Set objMail = OutlookApp.CreateItem(olMailItem)
        With objMail
           .BodyFormat = olFormatHTML
           .HTMLBody = "<HTML><BODY>Enter the message text here. </BODY></HTML>"
           .Display
        End With

    Try: 
    Dim fso As Scripting.FileSystemObject
    Dim htmlFile As Scripting.TextStream
    Set fso = New Scripting.FileSystemObject
    Set htmlFile = fso.OpenTextFile("C:\path\to\my-html-file.htm")
    strInsert = htmlFile.ReadAll
    then change:
    .htmlbody = strInsert
    oh, and you need to set a reference to the Scripting runtime in Tools, References. 
    Diane Poremsky [MVP - Outlook]
    Outlook & Exchange Solutions Center
    Outlook Tips
    Subscribe to Exchange Messaging Outlook weekly newsletter

  • Java.mail sending email in html format

    I trying to send emails from my java program, I ve managd to send text mails, I want to send email in html format is there a way of doing that and how
    thanks for your help

    Thanks a lot it is working now but I think that sending mails in text format is the best way since there isn't a way of knowing whether the recepient can handel html mails

  • Sending email in html format.

    i am trying to send email in html format. the following is my sample code. it's just sending plain text. how should i send html file in email?
    String message_body = "<a href=\"test.html\">click here</a>";
    MimeMessage msg = new MimeMessage( session );
    // From Address
    msg.setFrom( new InternetAddress( fromAddress ) );
    // TO Address
    InternetAddress recipient_Address = new InternetAddress( toAddress );
    msg.addRecipient(Message.RecipientType.TO, recipient_Address);
    // Subject
    msg.setSubject( subject );
    // MimeBodyPart object for message body part
    MimeBodyPart mbp1 = new MimeBodyPart();
    mbp1.setText( message_body );
    // MimeBodyPart object for file to attach
    MimeBodyPart mbp2 = new MimeBodyPart();
    Multipart mp = new MimeMultipart();
    // create the Multipart and add message body and file to attach.
    mp.addBodyPart(mbp1);
    // add the Multipart to the message
    msg.setContent(mp);
    msg.setSentDate(new Date());
    // send the message
    Transport.send(msg);
    i'd appreciated it...

    msg.setContent(mp, "text/html");Have I put this in the right place? You need to apply it to your body text, at any rate.

  • Send emails in html format

    Hi All,
    My requirement is to send emails. I am using javamail and it works fine. But the body of the email should be in table format.
    I am planning to use Html as below. But don't know how to combine html in java. Is there any other way of achieving it ? Please let me know if I am not clear.
    <htm>
    <table border="1">
    <tr>
    <td bgcolor="red">Header</td>
    </tr>
    <tr>
    <td bgcolor="yellow">Sub Header1</td>
    <td bgcolor="yellow">Sub Header1</td>
    </tr>
    <tr>
    <td bgcolor="green">Values</td>
    <td bgcolor="green">Values</td>
    </tr>
    </html>

    so, do I need another method which tells Java whereto output the HTML Tags ?
    The method writes to a PrintWriter defined somewhere,
    you can also pass the PrintWriter as third argument
    to the method.
    To generate a String containg the whole HTML Dokument
    you would write something like:
    StringWriter stringWriter = new StringWriter();
    PrintWriter printWriter = new
    PrintWriter(stringWriter);
    writeStartTable();
    writeStartRow();
    writeCell("BlaBla", "green");
    printEndTable();
    printWriter.flush();
    printWriter.close();
    stringWriter.close();
    String content = stringWriter().toString();
    BodyPart mailBody = new MimeBodyPart();
    mailBody.setContent(content, "text/html");
    I was succesful in sending mail using HTML format. Thanks for ur reply.
    But if I try send the mail in HTML format along with an attachment, the MIME type defaults to "text/plain".
    Is there a way to set the MIME type to "text/html" when I send mail with an attachment.
    Please help . Let me know if I am not clear

  • Send email in html format with pdf attachment

    I am trying to send an email out of SAP using an abap program in the html format with a pdf attachment. I am using the function module -SO_DOCUMENT_SEND_API1. I noticed that when i specify the body type of the message as 'RAW' I get to see the pdf attachments however when i switch it to 'HTM' I loose the attachment in the email generated. Can anyone please help me in solving this problem. Thanks!

      ld_email                 = p_email. "All email IDs
      ld_mtitle                 = 'Bank Statement'.
      ld_format                = 'PDF'. "Attachment Format
      ld_attdescription      = 'Statement'.
      ld_attfilename          = p_filename. "Name of file
      ld_sender_address      = p_sender_address. "Sender mail address
      ld_sender_address_type = p_sender_addres_type. "INT - Internet
    * Fill the document data.
      w_doc_data-doc_size = 1.
    * Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle . "Description
      w_doc_data-sensitivty = 'F'.
    * Fill the document data and get size of attachment
      CLEAR w_doc_data.
      READ TABLE it_attach INDEX w_cnt.
      w_doc_data-doc_size =
         ( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
      w_doc_data-obj_langu  = sy-langu.
      w_doc_data-obj_name   = 'SAPRPT'.
      w_doc_data-obj_descr  = ld_mtitle. "Description
      w_doc_data-sensitivty = 'F'.
      CLEAR t_attachment.
      REFRESH t_attachment.
      t_attachment[] = it_attach[].
    * Describe the body of the message
      CLEAR t_packing_list.
      REFRESH t_packing_list.
      t_packing_list-transf_bin = space.
      t_packing_list-head_start = 1.
      t_packing_list-head_num = 0.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE it_message LINES t_packing_list-body_num.
      t_packing_list-doc_type = 'HTM'. " THis is for BODY of mail RAW'.
      APPEND t_packing_list.
    * Create attachment notification
      t_packing_list-transf_bin = 'X'.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 1.
      t_packing_list-body_start = 1.
      DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
      t_packing_list-doc_type   =  ld_format.
      t_packing_list-obj_descr  =  ld_attdescription.
      t_packing_list-obj_name   =  ld_attfilename.
      t_packing_list-doc_size   =  t_packing_list-body_num * 255.
      APPEND t_packing_list.
    * Add the recipients email address
      CLEAR t_receivers.
      REFRESH t_receivers.
      t_receivers-receiver = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    * Populate zerror return code
      ld_error = sy-subrc.

  • Send email in HTML format with attachment.

    I want to send out email in HTML fromat and attach a file to it. I know how to send HTML email but I cant attach a file to it.
    Can anybody help me with that?

    What kind of attachment?
    1) A file not related to the HTML
    or 2) a file used by the HTML (i.e. a GIF)?
    If 1) see here http://developer.java.sun.com/developer/onlineTraining/JavaMail/contents.html#SendingAttachments
    If 2) see here http://forum.java.sun.com/thread.jsp?forum=43&thread=242791
    (make sure you read all the thread as inline attachments are mentioned at the end)
    SH

  • Send mail in HTML Format in Service Desk

    Dear Friends,
    We want to send email in html format to every user in service desk, how can we figure it?
    Thanks in advance
    Regards,

    Hello Eray,
    You will want to have a look at this document and hopefully it will assist you accomplish what you need.
    http://service.sap.com/~sapidb/011000358700001903822008E
    Regards,
    Paul

  • Send report in HTML format not in MHTML

    Hi all,
    I need to send report in email in HTML format not in MHTML format.
    Kindly help me.
    Thanks

    Hello,
    As far as I know, we cannot change the rsreportserver.config file to achieve this effect.
    In SSRS, the HTML rendering extension renders a report in HTML format. The HTML rendering extension is the default rendering extension for reports that are previewed in Report Builder and viewed in a browser, including when run in Report Manager.
    There is an article about Rendering to HTML, you can refer to it.
    http://technet.microsoft.com/en-us/library/dd255269.aspx
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • How to send mail in  HTML  format using SMTP

    I want to send mail in HTML format using SMTP.Can anybody please suggest how to do it.Can anybody send me the code.
    Thnx.

    If you don't know how to send a message using JavaMail see here : http://developer.java.sun.com/developer/onlineTraining/JavaMail/contents.html#JavaMailSending
    To send a html format mail you need to set the content type like this (msg is a javax.mail.internet.MimeMessage) :
    String subject = "An Email 4 U";
    String message = "<HTML><BODY>Here is a link<br><a href='http://javasoft.com'>Java</a></BODY></HTML>";
    msg.setSubject(subject);
    msg.setContent(message, "text/html");p.s This isn't really an advanced topic

  • Sending emails in HTML on iPhone?

    How do I configure the iPhone 5 to send emails in HTML? 

    Lucky I stopped by again
    We have heard of this problem from a small number of people over the last few weeks.
    Briefly it seems that some contacts can be formatted weirdly in your address book. The easiest solution seems to be to export the problem contact as vcf and reimport, which cleans the contact in some way, then it should be fine.
    More on solubleapps.com/MailShot-support, if you haven't visited there already.
    Any problems please get in touch on our support email address and we'll try our best to help. Also Watch for the new update in a week or so.
    Cheer, Peter

  • Customization of DAC to send emails in XML format

    Hi,
    We need to customize DAC to send emails in XML format to the support team whenever there is a failure of the ETL load.
    We use the HPSC ticketing system.
    Any help to achieve this functionality is much appreciated.
    we have tried to customize the existing email template of DAC, but it is not serving the purpose to generate the ticket in HPSC.
    To generate the HPSC ticket, we have a XML format. We need to customize DAC to use this format.
    This is the version of Oracle BI application we are using:
    Build: 10.1.3.2.1.070411.1900
    Release Version: Oracle Business Intelligence 10.1.3.2.1
    Package: 070411.1900
    Build: 7.9.1.032307.0900
    Release Version: Oracle Business Intelligence Applications 7.9.1
    Package: 032307.0900
    Regards,

    Hi,
    We have raised a SR with Oracle support and are in touch with Engineering also today onwards. However, would like to try out options while waiting for a solution/workaround for this issue.
    Regards,

  • How to view my email in HTML format instead of Plain Text format?

    I receive plenty of HTML format emails everyday.
    but when I check those emails on iPhone, all emails were automatically converted to Plain Text format.
    I wish to view my emails in HTML format (just as it shown in Outlook)
    with graphic (jpep loaded, instead of attachment), and Text formatting.
    Can anyone suggest me any solution?
    or do Mail apps in iPhone does not support HTML format?
    Pls guide.
    Thx.

    To get a source code for jsp mail visit http://www.jspinsider.com/tutorials/jsp/javamail.view

  • Blank email with HTML format

    when I get an email in HTML format on my phone , the message comes in whiteand occasionally get the html code unencrypted. i use Iphone 6 and my email server its Exchange server 2010 on premise.
    I hope you can help me.

    Try: 
    Dim fso As Scripting.FileSystemObject
    Dim htmlFile As Scripting.TextStream
    Set fso = New Scripting.FileSystemObject
    Set htmlFile = fso.OpenTextFile("C:\path\to\my-html-file.htm")
    strInsert = htmlFile.ReadAll
    then change:
    .htmlbody = strInsert
    oh, and you need to set a reference to the Scripting runtime in Tools, References. 
    Diane Poremsky [MVP - Outlook]
    Outlook & Exchange Solutions Center
    Outlook Tips
    Subscribe to Exchange Messaging Outlook weekly newsletter

Maybe you are looking for

  • HT1338 How can i use my data on windows or mac when i use one of them in the same time?

    Hi, i have a Mac book with 2 operating system, ( Windows& mac). How can i use my data on windows or mac when i use one of them in the same time? Thank you

  • Free of Charge Billing - Accounting Documents

    Hello, We want to raise accounting document for Free Of Charge Billing where we are debitting the excise duties and crediting the same value to clearing account. These conditions are marked as real in our pricing. know still bcoz of total credit and

  • N8: After provider change - how to find usage of o...

    Hi, I changed the provider and got a new set of APs for my N8-00. So I removed the old ones. Then I found out, that the positioning (geo location) service connects a server with an old, not updated AP. While changing this old AP to a current one, I s

  • Showing Icons in the table view column

    I am using a tableview. In that tableview first column, i want to display the status as icon_green_light, icon_red_light like that as an icon. I am having these status values in my table... when i am assigning that itab to this tableview it is showin

  • Background image for email document

    Hi , using cl_bcs i am sending some dat as mail. to this document i need to add the impage of my company as backgournd . I want to how can i store this image so that it will available for transport . thanks, Jaffer vali shaik