How to send HTML as message body using SMTP

I need to send HTML formatted emails. I used the Report Generation Toolkit to build my HTML document and make sure I had all of the formatting right. Then I modified the Save Report To File.vi to also give me the HTML text string on an output connector and I wire this string to the message input on the SMTP Email Send Message.vi.
I receive the email OK, but all I see is the HTML code in the message body. What can I do to make sure that the email displays the message correctly.
I use Outlook and I know it will receive and display HTML emails, I get them all the time.
I would appreciate any help.

Hi Dgw,
it is similar. You must change message MINE content-type to "text/html" type. Because everyone document in email protocol have set MINE content-type. It is inforamtion for email servers and for email cients (Thunderbird, Outlook and etc.)
For sendning mail with attachments you must use and modified "SMTP Send Multiple Attachments.vi" - if you can do backup of this VI and subVIs. Open Diagram of "SMTP Send Multiple Attachments.vi" after "SMTP Send Multiple
Attachments Message.vi" and ther is VI "MIME Send Data Attachment.vi" - have control "MIME content-type" but code from NI don't use it.
And like as my previous message, create new string control "MINE content-type" and take out this control to "main" Email VI.
And embedd
ed file you set up in control-cluster "attachments". I don't test it, but I mind thet must working :-)
Have nice day
JCC
Attachments:
email.jpg ‏70 KB

Similar Messages

  • How to send the same message to two SMTP servers

    hi,
    I need to send a message to two different SMTP servers.
    I want to avoid the creation of new MimeMessage with a new Session.
    the only way I've found was to keep a reference to the Properties instance that was used in the Session creation, and modify its "mail.smtp.host" property.
    Is there another way? I must be missing something.
    thanks,
    ofer

    hi,
    I've already found the solution, so I'll post it here.
    first I'll explain the purpose:
    I needed to send the same message to a normal email server, and (for some of the recipients) to a special SMTP server that is on a different machine.
    the following code demonstrate the solution.
    thanks for your help.
    ofer
    ----------code---------------
    public class MultipleSendTest {
    private final static Session server1 = createSession("somesmtp_server.com");
    private final static Session _server2 = createSession("another_smtp_server.com");
    public static void main(String args[]) throws Exception {
    //create the message
    MimeMessage m = new MimeMessage(_server1);
    m.setText("body text");
    m.addRecipients(Message.RecipientType.TO, "[email protected]");
    m.setFrom(new InternetAddress("[email protected]"));
    //send
    send(m, _server1);
    send(m, _server2);
    private static void send(MimeMessage message, Session session) {
    //for logging only
    String host = session.getProperty("mail.smtp.host");
    try {
    Transport transport = session.getTransport("smtp");
    transport.connect();
    transport.sendMessage(message, message.getAllRecipients());
    System.out.println("sent to " + host);
    transport.close();
    } catch (MessagingException e) {
    System.out.println("failed to send to " + host);
    private static Session createSession(String host) {
    Properties properties = new Properties();
    properties.setProperty("mail.smtp.host", host);
    return Session.getInstance(properties);
    ----------code---------------

  • How to send CC and/or BC using smtp-package

    I know how to send a message using the sun.net.smtp.SmtpClient.
    How can I include CC and/or BC ?
    Do I have to send this message a second/third time?

    If you are using raw SMTP then you could look through RFC 821 to see if your answer is there:
    http://www.faqs.org/rfcs/rfc821.html

  • How to send HTML mail with images multipart/related message

    Hi,
    Could any body tell me how to send HTML mail with images in "multipart/related" message,if any body can give the code ,it would be helpful.
    Thanks

    Hi,
    Could any body tell me how to send HTML mail with
    ith images in "multipart/related" message,if any body
    can give the code ,it would be helpful.
    ThanksHi!
    Refer to
    http://developer.java.sun.com/developer/onlineTraining/JavaMail/index.html
    I've found it very helpful.
    Look at the last part for a code showing how to send HTML mail!
    Regards

  • How to send HTML Format Mail using Java Mail in oracle 9i Forms

    Dear All
    could you please tell me how to send HTML Format Mail using Java Mail in oracle 9i Forms and how to implement the java mail ?
    if it is possible, could you please send me the sample code? please very urgent
    Thanks
    P.Sivaraman

    Hello,
    <p>Here is a Form sample.</p>
    Francois

  • Using Safari to send HTML Mail message but Mail keeps dropping images?

    I'd like to use Safari to send html Mail messages, but when I click on File>Mail Contents... Mail opens a new window but my graphics are gone. (I'm creating the html pages using MS Word for the Mac.) I get a flash of the graphics for a second, and then they are replaced by a little blue lego. Any ideas? I've tried all kinds of mail preferences but nothing seems to help.

    Figured it out (at least one way): had to load the image to a server and then add the image as a link only (uncheck "save picture with document" box).

  • Sending email  with message body contain data  in table   displayed in one

    Hi,
    I have one jsp page where I am dispalying the table data retrieved fron database.
    Now i am trying to send this table as message body of the mail to the user.I am doing same stuff last from six days but unable to send such data.
    Please help me Sir,as i am newbie here.
    Here is an jsp page.
        Document   : evaluationeventtable
        Created on : Jul 24, 2008, 6:52:37 PM
        Author     : user1
    --%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@ page language ="java" %>
    <%@ page import="java.sql.*, javax.sql.*, javax.naming.*,java.io.*,java.util.*" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>IGIDR</title>
            <link rel="stylesheet" href="../styles/styles.css" type="text/css">
        </head>
        <body>
             <table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr>
    <td><%@ include file="/includes/logohead.jsp" %></td>
    </tr>
    <tr><td><%@ include file="/toplinks.jsp"%></td></tr>
    <tr>
    <td width="100%" valign="top">
    <table width="100%" cellspacing="0" cellpadding="0" border="1" borderColor=#000066>
        <tr>
    <td width="80%"> 
        <%  int QNO;
             String message=null;
             //String message1=null;
             //String message2=null;
             String noA,noB,noC,noD;                
            String ID=request.getParameter("id");       
            String EVENTID=request.getParameter("event");       
            Connection connection = null;
            Statement st = null;
            Statement st1 = null;
            Statement st2 = null;
            Statement st3 = null;
            Statement st4 = null;
            Statement st5 = null;
            ResultSet rs= null;
            ResultSet rs1= null;
            ResultSet rs2= null;
            ResultSet rs3= null;
            ResultSet rs4= null;
            ResultSet rs5= null;
            Class.forName("com.mysql.jdbc.Driver");
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mynewdatabase","root", "root123");
                           st=con.createStatement();
                    try  {              
                      rs = st.executeQuery("SELECT * FROM Questionbank where Questionid='"+ID+"'");
                   %>
                <table border="1" cellpadding="2" cellspacing="3" bgcolor="#E6E6FA" align="center"><tr><th>Questions</th><th>A</th><th>B</th><th>C</th><th>D</th></tr>
                 <%  message="<table border=1 cellpadding=2 cellspacing=3 bgcolor=#E6E6FA align=center><tr><th>Questions</th><th>A</th><th>B</th><th>C</th><th>D</th></tr>";%>
                   <%
                  while ( rs.next() )
                            //String NO=rs.getString("Qserialno");
                            //session.setAttribute("no",NO);
                            //String NAME=rs.getString("questionname");
                            //session.setAttribute("name",NAME);                                    
                       %>
                       <tr><td><%=rs.getString("Qserialno") + "." + rs.getString("questionname")%></td>
                       <%
                        message=message+"<tr><td>"+rs.getString("Qserialno") + "." + rs.getString("questionname")+"</td>";
                       st1=con.createStatement(); 
                       try
                          rs1=st1.executeQuery("select count(*) as total  from final where questionid='"+ID+"'and Eventid='"+EVENTID+"'and Qserialno='"+rs.getString("Qserialno")+"'and Answer='A'");
                         rs1.next();
                         noA=rs1.getString("total");
                         session.setAttribute("NOA",noA);
                          rs1=st1.executeQuery("select count(*)  as total from final where questionid='"+ID+"'and Eventid='"+EVENTID+"'and Qserialno='"+rs.getString("Qserialno")+"'and Answer='B'");
                       rs1.next();
                         noB=rs1.getString("total");
                         session.setAttribute("NOB",noB);
                          rs1=st1.executeQuery("select count(*) as total  from final where questionid='"+ID+"'and Eventid='"+EVENTID+"'and Qserialno='"+rs.getString("Qserialno")+"'and Answer='C'");
                        rs1.next();
                         noC=rs1.getString("total");
                         session.setAttribute("NOC",noC);
                          rs1=st1.executeQuery("select count(*) as total  from final where questionid='"+ID+"'and Eventid='"+EVENTID+"'and Qserialno='"+rs.getString("Qserialno")+"'and Answer='D'");
                          rs1.next();
                         noD=rs1.getString("total");                   
                         session.setAttribute("NOD",noD);
                         message=message+"<td>"+noA+"</td><td>"+noB+"</td><td>"+noC+"</td><td>"+noD+"</td></tr></table>";
                         %>                     
                     <td><%=noA%></td><td><%=noB%></td><td><%=noC%></td><td><%=noD%></td></tr>
                   <%        
                         } finally
                               if (rs1 != null)
                                   rs1.close();
                                   rs1 = null;
                               } if (st1 != null)
                                   st1.close();
                                   st1 = null;
                                       finally
                               if (rs != null)
                                   rs.close();
                                   rs = null;
                               if (st != null)
                                   st.close();
                                   st = null;
                                   con.close();
                      %></table>   
                      <table align="center" width="50%" cellspacing="0" cellpadding="0" border="1" borderColor=#D2691E>
                      <form name="sendmail" action="/student/servletmail" method="POST">
                       <tr class="CellColor">
              <td>To</td>
              <td class="CellColor" width="1%">
              </td>
              <td class="CellColor">
                   <input type="text" name="to" size="25" value="">
              </td>
                    <td>From</td>
              <td class="CellColor" width="1%">
              </td>
              <td class="CellColor">
                   <input type="text" name="from" size="25" value="">
              </td>
         </tr>
            <input type="hidden" name="message" value="<%=message%>">
            <tr class="CellColor">
              <td class="CellColor" colspan="9" align="center">
                   <input type="submit" name="tn1" value="Send" >
              </td>
         </tr>   
      </form></table></td></tr></table>
                  </table>
                         </body></html>    And here is an servlet where i am trying to send the mail
    package com.student.igidr.test;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.event.*;
    import javax.mail.internet.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    * @author user1
    public class servletmail extends HttpServlet
            public  void doPost(HttpServletRequest request,HttpServletResponse response)
                                      throws ServletException, IOException
            PrintWriter out=response.getWriter();
            response.setContentType("text/html");
            try
               Properties props=new Properties();
               props.put("mail.smtp.host","webmail.igidr.ac.in");   //  'localhost' for testing
       Session   session1  =  Session.getDefaultInstance(props,null);
               String s1 = request.getParameter("to");
               String s2 = request.getParameter("from");
               //String s3 = request.getParameter("sub");
               String s4 = request.getParameter("message");
              // out.println(s4);
         Message message =new MimeMessage(session1);
         message.setFrom(new InternetAddress(s2));
          message.setRecipients
                 (Message.RecipientType.TO,InternetAddress.parse(s1,false));
              // message.setSubject(s3);
               message.setText(s4);       
              message.setContent(s4,"text/html");
               Transport.send(message);
               out.println("mail has been sent");
            catch(Exception ex)
               System.out.println("ERROR....."+ex);
    }I am using the message variable to send the message also as input variable in servlet.
    Whether it is write Way to represent hole table body into message variable in jsp page.
    Please help me.
    Thanks and Regards
    haresh
    Edited by: HARSHAL_GURAV on Aug 13, 2008 11:15 PM
    Edited by: HARSHAL_GURAV on Aug 13, 2008 11:56 PM

    Hi bshannon ,
    Thanks you very much for your reply.
    I am trying to send html formated mail to the user.
    The message body contains the table that is displayed in above jsp page as:
    <table border="1" cellpadding="2" cellspacing="3" bgcolor="#E6E6FA" align="center"><tr><th>Questions</th><th>A</th><th>B</th><th>C</th><th>D</th></tr>
    <tr><td><%=rs.getString("Qserialno") + "." + rs.getString("questionname")%></td>
    <td><%=noA%></td><td><%=noB%></td><td><%=noC%></td><td><%=noD%></td></tr>In above code I am displaying the data from table i jsp page in table format. The data is related to analysis of particular event and i am trying to send this data as message body of the email.
    As table displayed in html form can you assist me in how to send html data?
    I am using variable message to store all this table data .
    <%  message="<table border=1 cellpadding=2 cellspacing=3 bgcolor=#E6E6FA align=center><tr><th>Questions</th><th>A</th><th>B</th><th>C</th><th>D</th></tr>";%>
    message=message+"<tr><td>"+rs.getString("Qserialno") + "." + rs.getString("questionname")+"</td>";
      message=message+"<td>"+noA+"</td><td>"+noB+"</td><td>"+noC+"</td><td>"+noD+"</td></tr></table>";i am sending this variable through form.At servlet I am retrieving it like:
    String s1 = request.getParameter("to");
               String s2 = request.getParameter("from");
               //String s3 = request.getParameter("sub");
               *String s4 = request.getParameter("message");*Will this possible ?
    Please help meas i am troubling same with last from 7-8 days.
    I had gone through Faqs but unable to collect required information.
    Thanks and Regards
    Haresh
    Edited by: HARSHAL_GURAV on Aug 15, 2008 9:22 PM

  • How to send a SOAP message with attachments

    How to send a SOAP message with attachments thru webservice using axis-1_3 can any one sujjest.............................

    Please refer
    http://www.javaworld.com/javaworld/jw-09-2003/jw-0912-webservices.html
    http://xml.sys-con.com/read/40315.htm

  • How to send html newsletter via Mail app

    I want crystal and clear instruction as all the ones I have found either old fashioned and not relevant or skip that interesting part.
    I have already done html page (newsletter). Now I want to transform it somehow and send via Mail app so my contacts could receive it as html newsletter. If I need to attach txt message please add it to the instruction. I need complete how to send html newsletter.

    alabanco wrote:
    thanks. Now we've got to the most interesting part and intriguing one. Why should I upload html page to the server. I do understand uploading the images to server which will be used as links in my html mail. But why and how should I store that page in my server if I have CMS post instead from which I used pictures as links. SHould I create yet another type of post in CMS that is my html newsletter? That's not cool. What is the industry standard approach for that?
    By the way Mail.app uses that baby design templates for your messages. Why don't we have an option to delete all these creepy childish templates and store solid bold corporate style templates for newsletters and send it somehow? Or will it just attach the images to the message then? If so then it is not what I want and it is really depressing.
    The industry convention/"standard" is not to use html in email. Wheteher or not your html newsletter displays as you intended is at the mercy of the recipient and their email client settings.
    If you want to preserve your html layout and styles, save your newsletter as a pdf document and attach the pdf document to your email. Or, as already suggested, use a web server to serve your html newsletter.

  • How to Send an Email to Outlook using process type in RSPC?

    Hi,
    How to Send an Email to Outlook using process type in RSPC?
    We created lot of process variants, actually we want to send an mail to users if the DP Background job was succesfully finished.
    Actually i tried with create message its not happening...
    Plz let me know .. its urgent ...
    Regards,
    Satish

    Hello Satish,
    If you want to send a friendly message to your users, then you can do this by building an ABAP program that calls function module SO_NEW_DOCUMENT_SEND_API1 . You can then insert this ABAP program in your process chain (using the ABAP program process type) or as a second step in your background job. With this technique, you can send an email to SAP users, or to external users (e..g Outlook email addresses)
    Here's  a sample ABAP code:
      data: ls_docdata type SODOCCHGI1,
            lt_objcont type table of solisti1,
            lt_receivers type table of somlreci1,
            ls_objcont type solisti1,
            ls_receivers type somlreci1,
            ls_user type syuname.
    * Fill these variables with subject and msg lines that you need.
    data: MAIL_SUBJECT     TYPE STRING,
    MSG_LINE1     TYPE STRING,
    MSG_LINE2     TYPE STRING,
    MSG_LINE3     TYPE STRING,
    MSG_LINE4     TYPE STRING,
    MSG_LINE5     TYPE STRING.
      ls_docdata-obj_descr = mail_subject.
      ls_objcont-line = msg_line1.
      append ls_objcont to lt_objcont.
      ls_objcont-line = msg_line2.
      append ls_objcont to lt_objcont.
      ls_objcont-line = msg_line3.
      append ls_objcont to lt_objcont.
      ls_objcont-line = msg_line4.
      append ls_objcont to lt_objcont.
      ls_objcont-line = msg_line5.
      append ls_objcont to lt_objcont.
    * t_userlist contains the list of users to whom th email will be sent.
      loop at t_userlist into ls_user.
        ls_receivers-receiver = ls_user.
    "Change the type  here if email is for outlook users, See documentation
    " of function module in SE37
        ls_receivers-rec_type = 'B'.            
        ls_receivers-express = 'X'.
        append ls_receivers to lt_receivers.
      endloop.
      CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
        EXPORTING
          document_data                   = ls_docdata
        tables
         OBJECT_CONTENT                   = lt_objcont
         receivers                        = lt_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
    You can test out the function module first in SE37 (just put the name of the FM and click execute). Testing it in SE37 will help you get your parameters right.
    Hope this helps.

  • How to send a text message to a group of people and save the list for next time?

    how to send a text message to a group of people and save the list for next time from an iphone 4s?

    Hey there ipremacha,
    It sounds like you need to enable Text Message Forwarding on your iPhone for your iPad to send MMS/SMS messages through your phone.
    Connect your iPhone, iPad, iPod touch, and Mac using Continuity
    Go to Messages > Text Message Forwarding, and enable the device(s) you would like to forward messages to.
    Your Mac, iPad, or iPod touch will display a code. Enter this code on your iPhone to verify the SMS feature.
    Thank you for using Apple Support Communities.
    Regards,
    Sterling

  • How to send html email made in dreamweaver

    how to send html email made in dreamweaver

    Make sure you upload all of the images used in your email to a server you control. Then, change your image paths to point to those uploaded images with absolute links.
    You will get marked as spam if you attempt to send images as attachments to a large list of recipients and most email clients won't download images to begin with, so make sure your html email makes sense with broken pictures.
    CSS support is spotty across email clients, if you use css, make sure it's inline, not embedded in the <head> or externally linked in the <head>. Some email clients strip out the <head> section entirely.
    Basically, you need to design your html email as if you haven't moved out of the 90's yet, as far as web design is concerned, in order to get maximum cross client compatibility.
    Then, when you're ready, I would suggest using a service like www.icontact.com or www.constantcontact.com if your subscriber list is anywhere over 100 or so recipients.

  • How to send HTML DOM to Servlet?

    How to send HTML DOM to Servlet?

    What exactly you mean by sending DOM to servlet?? if you want to post the entire html to servlet use XMLHttp object and post the entire html to servlet. You can get more info on XMLHttp at microsoft's MSDN site.

  • How to send a JMS message to a server ....

    Hi
    I want to know how to send a jms message to a Queue and that is in a different server...
    How to send A message using a application client to a Message queue That is in another Machine(Server is in another machine )
    env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.cosnaming.CNCtxFactory");
    env.put(Context.PROVIDER_URL, "iiop://127.0.0.1:3700/");
    InitialContext initialContext = new InitialContext(env);
    connectionFactory = (ConnectionFactory) initialContext.lookup("jms/ConnectionFactory");
    queue = (Queue) initialContext.lookup("jms/Queue");
    get a NameNotFoundException
    Anyone have an Idea
    thanks
    Ishkmi
    Message was edited by:
    ishkmi

    ok..try this..insert the ip address of the server where ur app server is
    running . i understand ur client and server is running on diff machines.
    ip address 127.0.0.1 is for local host. it tries to look for the server in
    same system as the client.
    substitue ip address of server in below line instead of 127.0..0.1
    env.put(Context.PROVIDER_URL, "iiop://127.0.0.1:3700/");
    best of luck ..lemme know..

  • How to send SMS ( Short Message Service ) from java code

    Hi
    How to send SMS ( Short Message Service ) from java code.
    Thanks
    Gaurav

    Do you need to receive SMS? If you need to receive SMS, you will need to host your own GSM device or modem so that people can send you SMS.
    If not, you can just use internet SMS gateways like clickatell as mentioned above will do the work, and post to them by HTTP, XML or email. The cost is about 6-8 cents per SMS. There are cheaper services, but not always reliable. If you need to host your own GSM device, you can use software like http://www.kannel.org (GPL Open Source) or http://www.visualgsm.com. Alternatively, you may obtain a shortcode from your Telco - but these come with monthly subscription of maybe one or two hundreds.
    Regards,
    Joshua
    <SMS Gateway>@Expert

Maybe you are looking for

  • Maintenance View - Can you sort/Filter? How to create z transaction for it?

    Hi, I will be creating a maintenance view that will be used several times at the end of every month, eventually storing more than 500 entries. Is there anyway for the user to be able to sort/filter the maintenance view by field? This would be helpful

  • Convert jsp to pdf?

    The code displays the desired output from a jsp. It is a report (table of computed values). I need to convert it to pdf. i've been working on this but i fail. Here is the code of the jsp where the content of the report is generated.. <%@ page languag

  • Help to Configure WF mailer notification

    Hi gurus,           We configure the approval through mail with help of oracle document ID, after we configure system not generate the mail notification to user.Please help us to configure in my instance. Regards, Udhayan

  • Listening while recording through headphones!

    So, I am currently using an M-Audio Profire 610 interface connected via a 6pin to 9 pin firewire to record some vocals and acoustic guitar parts with an Audi0-Technia AT2020 condenser mic. EVerything is hooked up fine and I can record with garageband

  • IPhoto freezes synching iPhone photos iOS 6

    First synch of photos after upgrade of iPhone 4S to IOS6, iPhoto progress bar and twirling color shell kept going, pics never transferred. Had to forcecquitbiPhoto. Retries gave same result.