Sending HTML Mails using SO_DOCUMENT_SEND_API1

Dear all,
we were using SO_DOCUMENT_SEND_API1 to send plain text e-mail replies to participants of an incentive program. Now the customer wants to send HTML mails. Customer has provided HTML templates for the mails, and the text always is the same, only slight changes in regard to the particpants number occur. Has anybody ever performed sending HTML formated mails without using SmartForms?
Thanks for your help!
Kind Regards
Chris

Sure.. here is a sample program.
report zrich_0002.
data: maildata   like sodocchgi1.
data: mailtxt    like solisti1 occurs 10 with header line.
data: mailrec    like somlrec90 occurs 0  with header line.
start-of-selection.
  clear:    maildata, mailtxt,  mailrec.
  refresh:  mailtxt, mailrec.
  perform build_text_message.
  perform build_receivers.
  perform send_mail_nodialog..
*      Form  BUILD_TEXT_MESSAGE
form build_text_message.
  maildata-obj_name = 'TEST'.
  maildata-obj_descr = 'Test Subject'.
  mailtxt  = '<html>'.
  append mailtxt.
  mailtxt  = '<head>'.
  append mailtxt.
  mailtxt  = '<title>Untitled Document</title>'.
  append mailtxt.
  mailtxt  = '<meta http-equiv="Content-Type" content="text/html;'.
  append mailtxt.
  mailtxt  = 'charset=iso-8859-1">'.
  append mailtxt.
  mailtxt  = '</head>'.
  append mailtxt.
  mailtxt  = '<body>'.
  append mailtxt.
  mailtxt  = '<div align="center"><em><font' .
  append mailtxt.
  mailtxt  = 'color="#0000FF" size="+7" face="Arial,'.
  append mailtxt.
  mailtxt  = 'Helvetica, sans-serif">THIS'.
  append mailtxt.
  mailtxt  = '  IS A TEST </font></em><font' .
  append mailtxt.
  mailtxt  = 'color="#0000FF" size="+7" face="Arial,'.
  append mailtxt.
  mailtxt  = 'Helvetica, sans-serif"></font>'.
  append mailtxt.
  mailtxt  = '</div>'.
  append mailtxt.
  mailtxt  = '</body>'.
  append mailtxt.
  mailtxt  = '</html>'.
  append mailtxt.
endform.
*      Form  BUILD_RECEIVERS
form build_receivers.
*  mailrec-receiver = '[email protected]'.
  mailrec-rec_type  = 'U'.
  append mailrec.
endform.
*      Form  SEND_MAIL_NODIALOG
form send_mail_nodialog.
  call function 'SO_NEW_DOCUMENT_SEND_API1'
       exporting
            document_data              = maildata
            document_type              = 'HTM'
            put_in_outbox              = 'X'
       tables
            object_header              = mailtxt
            object_content             = mailtxt
            receivers                  = mailrec
       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.
  if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.
endform.
Regards,
Rich Heilman

Similar Messages

  • Sending HTML mail using code in workflow

    Hi All
    I follow somerecomendation to create a program to send the mail out. using a program
    My code looks as the following.
        DATA:   l_docdata TYPE sodocchgi1,
                li_content TYPE TABLE OF solisti1,
                li_receiver TYPE TABLE OF somlreci1,
                l_ename     TYPE pa0002-cname,
                l_text(255),
                lw_receiver TYPE somlreci1.
        l_docdata-obj_name = 'Notification'.
        l_docdata-sensitivty = 'P'.
        l_docdata-proc_syst = sy-sysid.
        l_docdata-proc_clint = sy-mandt.
        l_docdata-obj_descr = 'TEST'.
    l_text  = 'Testing Content'.
    APPEND l_text TO li_content. CLEAR l_text.
    lw_receiver-receiver = 'MyMailtest@GM ail.com'.
    lw_receiver-rec_type = 'U'.
    APPEND lw_receiver TO li_receiver.
        CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
          EXPORTING
            document_data              = l_docdata
            commit_work                = 'X'
            DOCUMENT_TYPE              = 'HTM'
          TABLES
            object_content             = li_content
            receivers                  = li_receiver
          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.
    I try to use the code above and i manage to send the mail out. However when i change the l_text  = 'Testing Content'  to  l_text  = '<A HREF="http://www.google.com">Click Here</A>'  , it does not reach my mailbox even in in transaction SCOT, i can see that it was succesfully transmited.
    Anyone have any idea about this?
    Thanks.
    Regards,
    Bryan.

    Hey PJ,
    I manage to send out the email using the htm type. However, instead of having a hyperlink saying click here and it link to another page, i am getting something like this in the email.
    Click Here <http://www.google.com> 
    In my code, i write 
    <A HREF="http://www.google.com">Click Here</A>
    , but the content just turn to above. What i wan is a CLICK HERE link and will link to google.
    Thanks.
    Regards,
    Bryan.

  • 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 HTML email with SO_DOCUMENT_SEND_API1

    Hi all,
    I have implemented a function module to send HTML emails with SO_DOCUMENT_SEND_API1.
    It works fine, but in every email I have at the end a CRLF which looks not very nice in MS Outlook.
    It seems that this will be added to every email in addition to my HTML text.
    Has anyone an idea how I can prevent this?
    Thanks in advance for your help.
    Best Regards,
    Marcel

    Hi Marcel,
    not only you can, you should use CL_BCS for sending of email. Although I expect it to be not too different from the old functions, it points to the object oriented future of SAP/ABAP. At least it should run more stable and SAP recommends to use it as a replacement for old functions.
    I came across one blog
    [Sending HTML Email from SAP CRM/ERP|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2058700050DB10227264795501776639End?blog=/pub/wlg/2273]
    You may be careful with this one: Probably it's not exactly what you need.
    The one I love most for its simplicity is this one
    [Unknown thus unloved?|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2058700050DB10227264795501776639End?blog=/pub/wlg/3443]
    although it does not mention HTML - I think easy for you to adapt. Compared  to functional SO_DOCUMENT.. approach the program will shrink.
    If you want to understand the concepts behind, nobody explains it better than
    [Thomas Jung: Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2058700050DB10227264795501776639End?blog=/pub/wlg/789]
    or - if you still feel unsafe in oo environment -
    [Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417300%29ID2058700050DB10227264795501776639End?blog=/pub/wlg/15408]
    Happy coding!
    Regards,
    Clemens

  • Unable to sending a mail using odisend mail

    Hi,
    i have a need to send a mail using odi send mail, i am using gmail server getting to send a mail, but it getting error like this
    com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. d19sm1563829ibh.8
         at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388)
         at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959)
         at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583)
         at javax.mail.Transport.send0(Transport.java:169)
         at javax.mail.Transport.send(Transport.java:99)
         at com.sunopsis.dwg.tools.SendMail.actionExecute(SendMail.java:220)
         at com.sunopsis.dwg.function.SnpsFunctionBase.execute(SnpsFunctionBase.java:276)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execIntegratedFunction(SnpSessTaskSql.java:3430)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.executeOdiCommand(SnpSessTaskSql.java:1491)
         at oracle.odi.runtime.agent.execution.cmd.OdiCommandExecutor.execute(OdiCommandExecutor.java:32)
         at oracle.odi.runtime.agent.execution.cmd.OdiCommandExecutor.execute(OdiCommandExecutor.java:1)
         at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:540)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
         at java.lang.Thread.run(Thread.java:662)
    please share your opinions for this post
    Regards,
    901202

    http://www.oracle.com/technetwork/java/javamail/faq/index.html#starttls

  • How to send Html Mail through navigateToUrl() with contentType "text/html" for Android ?

    Isn't it possible to send Html Mail through navigateToUrl() with contentType "text/html" for Android ? please suggest any workaround
    Thanks

    AHHHH
    What you can do to make HTML for Apple Mail is to make it in an HTML editor, open it with Safari use CMD+i - a new mail message will appear in a moment with the web page in the email body.
    You can't do any major editing in Mail, you'll have to go back to the HTML file. But it works.
    You can also use Copy (from a web page) and then (Edit) Paste as HTML (that what Paste as HTML is for, not for creating HTML email). You can also user Paste as HTML to copy/paste a HTML email you receive or part of a HTML email.

  • How to send CC email using SO_DOCUMENT_SEND_API1

    Hi,
       How to send CC email using SO_DOCUMENT_SEND_API1.  Any sample code is very much appreciated.
    Cheers

    Please check In this function there is a flag in RECEIVERS table for sending mail as COPY or BLIND COPY

  • HTML mail using Email Control

    I am trying to send a mail using Email control in workshop. When I do
    content-type="html"
    the mail does not go through. when I do content-type="text/plain", it works fine.
    Has anybody encountered this behavior? What do I need to be able to send an html
    mail?
    thanks,
    John Jones

    "John Jones" <[email protected]> wrote:
    >
    I am trying to send a mail using Email control in workshop. When I do
    content-type="html" try content-type="text/html"
    >
    the mail does not go through. when I do content-type="text/plain", it
    works fine.
    Has anybody encountered this behavior? What do I need to be able to send
    an html
    mail?
    thanks,
    John Jones

  • How to auto-send html mail

    I've created what the php manual says should work to send
    html mail to our customer automatically from the website after a
    purchase, along with headers to send a bcc to us.
    But the finished product coming out of DW is a message body
    with all the code tags and headers in the body of the email, not a
    nice html email.
    I originally created this in GL, and have brought it over to
    DW.
    Is there maybe a better way to do this?
    Here's my code:

    That should work fine, I believe.
    But there are commercial products that may be what you would
    want to
    consider. WebAssist has one called UniversalEmail, that I
    like very much -
    http://www.webassist.com
    It will allow you to send both an HTML and a plain text
    email. I use it
    frequently.
    I have an affiliate link on my website, and if you are
    interested, please
    use that -
    http://www.great-web-sights.com
    (I am not an employee of WebAssist, but I do use/like their
    products)
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "rlinsurf1" <[email protected]> wrote in
    message
    news:[email protected]...
    > I've created what the php manual says should work to
    send html mail to our
    > customer automatically from the website after a
    purchase, along with
    > headers to
    > send a bcc to us.
    >
    > But the finished product coming out of DW is a message
    body with all the
    > code
    > tags and headers in the body of the email, not a nice
    html email.
    >
    > I originally created this in GL, and have brought it
    over to DW.
    >
    > Is there maybe a better way to do this?
    >
    > Here's my code:
    >
    >
    > <?php
    >
    > $message = '<html>
    >
    > <head>
    > <meta http-equiv="content-type"
    content="text/html;charset=utf-8" />
    > <style type="text/css" media="all"><!--
    > .dsR5 /*agl rulekind: base;*/ { width: 645px; height:
    75px; }
    > .dsR6 /*agl rulekind: base;*/ { width: 645px; height:
    158px; }
    > .emailtext { color: gray; font-size: 10pt; font-family:
    Verdana, Arial,
    > Helvetica, sans-serif; }
    > .headertext { color: gray; font-size: 14pt; font-family:
    Verdana, Arial,
    > Helvetica, sans-serif; font-weight: bold; }
    > .ds4 /*agl rulekind: base;*/ { font-size: 15px; }
    > .ds10 /*agl rulekind: base;*/ { font-size: 12px; }
    > --></style>
    > </head>
    >
    > <body>
    > <p><img class="dsR5"
    >
    src="https://ssl21.pair.com/grndlvl/commerce/gl/images/GRLogo.gif"
    alt=""
    > border="0" /></p>
    > <p class="headertext">Groundlevel Store
    Order</p>
    > <table class="dsR6" border="0" cellspacing="0"
    cellpadding="0">
    > <td><span
    class="emailtext">Name:</span></td>
    > <td class="emailtext"><?php echo $fullname;
    ?></td>
    > </tr>
    > <tr>
    > <td><span class="emailtext">Email
    Address:</span></td>
    > <td class="emailtext"><?php echo $email;
    ?></td>
    > </tr>
    > <tr>
    > <td><span
    class="emailtext">Date:</span></td>
    > <td class="emailtext"><?php echo $orderdate;
    ?></td>
    > </tr>
    > <tr>
    > <td><span
    class="emailtext">Product:</span></td>
    > <td class="emailtext"><?php echo
    $item;?></td>
    > </tr>
    >
    > <tr>
    > <td><span
    class="emailtext">Total:</span></td>
    > <td class="emailtext"><?php echo$total;
    ?></td>
    > </tr>
    >
    > </table>
    > <p class="headertext"><span
    class="ds4">Thank You for Your
    > Order</span></p>
    > <p class="headertext"><span class="ds10">You
    can expect your order to be
    > delivered promptly. You will also receive notifcation of
    your shipment
    > along
    > with the tracking information from the carrier you
    selected for delivery,
    > either USPS, UPS or Fedex. If you have any questions
    about your order,
    > please
    > email us at:
    [email protected].</span></p>
    > </body>
    >
    > </html>';
    >
    > $headers = 'MIME-Version: 1.0' . "\r\n";
    > $headers .= 'Content-type: text/html;
    charset=iso-8859-1' . "\r\n";
    > $headers .= 'From: Groundlevel Store
    <[email protected]>' . "\r\n";
    > $headers .= 'Bcc: [email protected]' . "\r\n";
    >
    >
    > mail($email,"Your Groundlevel Store Order",$message,
    $headers) // this
    > line is
    > the ending tag
    >
    > ?>
    >

  • If I click on an e-mail address link in a web page instead of a blank message opening I always get a pop up screen with a log-in for googlemail. I do not have and do not want a googlemail account. I just want to be able to send e-mails using Outlook.

    If I click on an e-mail address link in a web page instead of a blank message opening I always get a pop up screen with a log-in for googlemail. I do not have and do not want a googlemail account. I just want to be able to send e-mails using Outlook.

    OUtlook was already set as the mail client for FF, and is my operating system (XP)'s default mail programme. therefore problem not solved at all. what I get whenever I follow a link in a webpage to send an e-mail is a little pop up window asking me to sign in to gmail or open an account. any other suggestions?

  • 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

  • Sending e-mail using utl_smtp on oracle 9i

    Hello
    I have problem with sending e-mails using utl_smtp package.
    My code looks like this:
    lv_mail_conn := utl_smtp.open_connection(lv_mailhost_txt);
    utl_smtp.ehlo(lv_mail_conn, lv_mailhost_txt);
    res :=     utl_smtp.command(lv_mail_conn, 'AUTH LOGIN');
    res := utl_smtp.command(lv_mail_conn, <login in base64>);
    res := utl_smtp.command(lv_mail_conn, <password in base64>);
    And I get en error after sending a password to SMTP server.
    Error code: 535, text: 5.7.3 Authentication unsuccessful.
    This happens on oracle 9i.
    I have another server for testing which has oracle 10g installed. This code works fine on oracle 10g but doesn't work on oracle 9i.
    Do you have any ideas what's wrong? I assume that SMTP server (microsoft exchange) work correctlys because I can send e-mail from test server.

    Ok problem solved :)
    Problem was between oracle and MS exchange server. Live server oracle 9i is on linux, and testing server works on windows.
    So the problem was with configuration. Our admins corrected it and now works :). I don't know details.

  • How to bypass proxy when trying to send a mail using javamail smtp

    Hi,
    I am trying to make a servlet send a mail using javamail smtp protocol on port 25 but i m not able to send getting an exception, i suspect proxy is blocking, so any idea anyone how bypass a proxy.

    And if it does turn out that there's a proxy server blocking access to your target SMTP server, the best way to deal with that is to discuss the issue with the person responsible for your network configuration.

  • How to send e-mail using PL/SQL

    I need to send e-mail using PL/SQL. Is it possible?
    Thanks in advance,
    Agnaldo

    Yes. Use the UTL_SMTP package

  • Send HTML mail with an image

    Hi there,
    I'm trying to send html mail with an image. I'm able to see the image but in another section, at the very bottom of my message. Is it possible to display the image in the main part of my message ?
    Here my code :
    MimeMultipart multi = new MimeMultipart();
    BodyPart messageBodyPart = new MimeBodyPart();
    String htmlText = <H1>Test</H1><img src=\"cid:image\">";
    messageBodyPart.setContent(htmlText, "text/html");
    multi.addBodyPart(messageBodyPart);
    MimeBodyPart imagePart = new MimeBodyPart();
    DataSource fds = new FileDataSource("C:\\Resources\\Templates\\logo.jpg");
    imagePart.setFileName( "geologo.jpg" );
    imagePart.setDataHandler(new DataHandler(fds));
    imagePart.setHeader("Content-ID","<image>");     
    multi.addBodyPart(imagePart);
    msg.setContent(multi);
    Transport.send(msg);

    How many different e-mail clients have you tested that with?

Maybe you are looking for