Lines Display when sending E-Mail using SO_NEW_DOCUMENT_ATT_SEND_API1

Good Afternoon,
I'm using the following code to send e-Mails:
  LOOP AT t_z3emailusr INTO w_z3emailusr.
    t_receivers-receiver = w_z3emailusr-email.
    t_receivers-rec_type = 'U'.
    t_receivers-express  = 'X'.
    APPEND t_receivers.
  ENDLOOP.
  MOVE text-003 TO t_mailtxt-line.
  APPEND t_mailtxt.
  CLEAR t_mailtxt-line.
  APPEND t_mailtxt.
  MOVE text-001 TO t_mailtxt-line.
  APPEND t_mailtxt.
  CLEAR t_mailtxt-line.
  APPEND t_mailtxt.
  LOOP AT t_apqi INTO w_apqi.
    MOVE w_apqi-groupid TO t_mailtxt-line.
    APPEND t_mailtxt.
  ENDLOOP.
  MOVE text-002 TO t_mailtxt-line.
  APPEND t_mailtxt.
  CLEAR t_mailtxt-line.
  APPEND t_mailtxt.
  MOVE text-003 TO t_mailtxt-line.
  APPEND t_mailtxt.
  MOVE text-004 TO t_mailtxt-line.
  APPEND t_mailtxt.
  CLEAR t_mailtxt.
  DESCRIBE TABLE t_mailtxt LINES mailtxt_size.
  MOVE text-000 TO t_doc_att-obj_descr.
  MOVE sy-langu TO t_doc_att-obj_langu.
  MOVE 'O'      TO t_doc_att-sensitivty.
  t_doc_att-doc_size = mailtxt_size * 255.
  CLEAR t_mailpack-transf_bin.
  MOVE 1 TO t_mailpack-head_start.
  CLEAR t_mailpack-head_num.
  MOVE 1            TO t_mailpack-body_start.
  MOVE mailtxt_size TO t_mailpack-body_num.
  MOVE 'HTM'        TO t_mailpack-doc_type.
  MOVE sy-langu     TO t_mailpack-obj_langu.
  APPEND t_mailpack.
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = t_doc_att
      put_in_outbox              = 'X'
    TABLES
      packing_list               = t_mailpack
      contents_txt               = t_mailtxt
      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.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
Everything is ok except for the text...
Although i'm appending lines in t_mailtxt the text of the e-mail is continuous...
How to display text with "line breaks"? Do i need to change the doc_type of t_mailpack?
Regards,
Pedro Gaspar

Yes .. change the doc_type.

Similar Messages

  • Sending external mail using SO_NEW_DOCUMENT_ATT_SEND_API1

    When i use this RFC by appending the internal table receiver with receiver: sapuser name and rec_type  B it triggers mail to the sap user login .But when i give external email address for receiver with rec_type 'U' it is not triggering any mail.Can anyone please tell me how to use this RFC in sending external mails??

    I went back and you are right "INT" was not the REC_TYPE it was the COM_TYPE.
    Sorry for any confusion caused.
    However,
    I suggest 2 more tests and then I give up and can not think about anything else.
    Try:
    #1
    REC_TYPE = 'X'.
    if it does not work.
    #2
    REC_TYPE = 'R'.
    Hope that will do the trick. I was trying a lot when I had to get that working some time ago.
    And surely the other colleagues point to something which must be setup as well. Transaction SCOT the SMTP settings.
    Furthermore there could be another issue. I remember that I worked at a client who had turned off the send settings on their email server. So SAP finished everything and handed the emails on to a mail server. The mail server had a setting to block any emails from the development environment.
    So that might be another cause of your issue.

  • Mail.jar is locked when sending a mail using servlet and not releasing

    Hi everybody,
    The mail.jar is locked in tomcat while sending the first message and not released until the tomcat get restarts.
    the problem is not recorded in any logs.
    1. Please create a servlet that sends mail
    2. Send a mail to any mailid
    3. then after the mail is send please try to delete the mail.jar or please deploy the same servlet again with some small changes (for redeploying take place only a few changes is there - please change any strings a little bit)
    then try to send mail using this servlet will not send mail becoause it will not redployed correctely.
    when i removed Transport.send(msg); from code it works fine. but ??
    please help me to recover from this issue. i don't want to turn on tomcat antiJarlocking and antiresourcelocking to true, becaouse this craete many other problems.
    please help me to recover from this issue.
    Thanks,
    Prasad.N

    hi friend
    I am using advanced version of jdk. i i have used many other jar files like mysqlconnector, logging, commonhttpclient, etc.... the only problem is with mail.jar. that locks are released when its use completed, but the lock holds until tomcat shutdown in mail.jar.
    what may be the reason?
    Thanks,
    Prasad.N

  • Error getting while sending the Mails using 'SO_NEW_DOCUMENT_ATT_SEND_API1'

    Hi ALL,
       I HAVE THE REQUIREMENT AS SEND A REPORT AS A MAIL. IAM USING FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' WHILE EXECUTING ITS NOT SHOWING ANY ERROR. BUT IAM NOT GETTING ANY MAIL. I CHECKED IN 'SOST' TCODE. THERE I SEE A MESSAGE LIKE 'CANNOT PROCESS THE MSG TYPE IN SAP SYSTEM'. PLS TELL ME THE WHAT IS THE PROBLE.

    Hi
    Please dont write in Capital letters, it considered as shouting. Hope you are aware of the forum rules.
    You can check if you have made anything wrong in coding by referring wiki link.
    [Sending Mails |http://wiki.sdn.sap.com/wiki/display/ABAP/SendingMails-HomePage]
    Regards
    Abhii

  • Getting error when sending SMTP mail using javamail api

    hi all
    i am new to javamail api...and using it first-time....i'v used the following code
    <%
    String mailHost="mail.mastsale.com";
    String mailText="Hello this is a test msg";
    String to="<a href="mailto:[email protected]">[email protected]</a>";
    String subject="jsp test mail";
    try
    String from="<a href="mailto:[email protected]">[email protected]</a>";
    String mailhost = "mail.mastsale.com";
    Properties props = System.getProperties();
    props.put("mail.smtp.host", mailhost);
    // Get a Session object
    Authenticator auth = new SMTPAuthenticator( "<a href="mailto:[email protected]">[email protected]</a>", "abcd" );
    Session session1 = Session.getInstance(props,auth);
    //Session.setDebug(true);
    //construct message
    Message msg = new MimeMessage(session1);
    msg.setFrom(new InternetAddress(from,"Your Name"));
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
    msg.setSubject(subject);
    msg.setText(mailText);
    //msg.setHeader("X-Mailer",mailer);
    msg.setSentDate(new Date());
    msg.saveChanges();
    //Send the message
    out.println("Sending mail to " + to);
    Transport.send(msg);
    catch (MessagingException me)
    out.println("Error in sending message for messaging exception:"+me);
    %>
    and
    SMTPAuthenticator.java
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    public class SMTPAuthenticator extends javax.mail.Authenticator {
    private String fUser;
    private String fPassword;
    public SMTPAuthenticator(String user, String password) {
    fUser = user;
    fPassword = password;
    public PasswordAuthentication getPasswordAuthentication() {
    return new PasswordAuthentication(fUser, fPassword);
    Now getting error as: Error in sending message for messaging exception:javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 550-(host.hostonwin.com) [208.101.41.106] is currently not permitted to relay 550-through this server. Perhaps you have not logged into the pop/imap server 550-in the last 30 minutes or do not have SMTP Authentication turned on in your 550 email client.
    Can anyone help me?

    i got the following error while using the below code,
    -----------registerForm----------------
    DEBUG: setDebug: JavaMail version 1.3.2
    DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
    DEBUG SMTP: useEhlo true, useAuth true
    :::::::::::::::::::::::::::::::::<FONT SIZE=4 COLOR="blue"> <B>Error : </B><BR><HR> <FONT SIZE=3 COLOR="black">javax.mail.AuthenticationFailedException<BR><HR>
    -----------registerForm----------------
    public class SendMailBean {
    public String send(String p_from, String p_to, String p_cc, String p_bcc,
    String p_subject, String p_message, String p_smtpServer,String FilePath) {
    String l_result = "";
    // Name of the Host machine where the SMTP server is running
    String l_host = p_smtpServer;
    //for file attachment
    String filename = FilePath;
    // Gets the System properties
    Properties l_props = System.getProperties();
    // Puts the SMTP server name to properties object
    l_props.put("mail.smtp.host", l_host);
    l_props.put("mail.smtp.auth", "true");
    // Get the default Session using Properties Object
    Session l_session = Session.getDefaultInstance(l_props, null);
    l_session.setDebug(true); // Enable the debug mode
    try {
    MimeMessage l_msg = new MimeMessage(l_session); // Create a New message
    l_msg.setFrom(new InternetAddress(p_from)); // Set the From address
    // Setting the "To recipients" addresses
    l_msg.setRecipients(Message.RecipientType.TO,
    InternetAddress.parse(p_to, false));
    // Setting the "Cc recipients" addresses
    l_msg.setRecipients(Message.RecipientType.CC,
    InternetAddress.parse(p_cc, false));
    // Setting the "BCc recipients" addresses
    l_msg.setRecipients(Message.RecipientType.BCC,
    InternetAddress.parse(p_bcc, false));
    l_msg.setSubject(p_subject); // Sets the Subject
    // Create and fill the first message part
    MimeBodyPart l_mbp = new MimeBodyPart();
    //123
    ///////l_mbp.setText(p_message);
    l_mbp.setContent(p_message,"text/html");
    // Create the Multipart and its parts to it
    Multipart l_mp = new MimeMultipart();
         //l_mp.setContent(html,"text/html");
    l_mp.addBodyPart(l_mbp);
    // Add the Multipart to the message
    l_msg.setContent(l_mp,"text/html");
    // Set the Date: header
    l_msg.setSentDate(new Date());
    //added by cibijaybalan for file attachment
         // attach the file to the message
    //Multipart l_mp1 = new MimeMultipart();
         if(!filename.equals(""))
                   String fname = filename;
                   MimeBodyPart mbp2 = new MimeBodyPart();
                   FileDataSource fds = new FileDataSource(fname);
                   mbp2.setDataHandler(new DataHandler(fds));
                   mbp2.setFileName(fds.getName());
                   l_mp.addBodyPart(mbp2);
              // add the Multipart to the message
              l_msg.setContent(l_mp);
    //ends here
         l_msg.setSentDate(new java.util.Date());
    // Send the message
    Transport.send(l_msg);
    // If here, then message is successfully sent.
    // Display Success message
    l_result = l_result + "Mail was successfully sent to : "+p_to;
    //if CCed then, add html for displaying info
    //if (!p_cc.equals(""))
    //l_result = l_result +"<FONT color=green><B>CCed To </B></FONT>: "+p_cc+"<BR>";
    //if BCCed then, add html for displaying info
    //if (!p_bcc.equals(""))
    //l_result = l_result +"<FONT color=green><B>BCCed To </B></FONT>: "+p_bcc ;
    //l_result = l_result+"<BR><HR>";
    } catch (MessagingException mex) { // Trap the MessagingException Error
    // If here, then error in sending Mail. Display Error message.
    l_result = l_result + "<FONT SIZE=4 COLOR=\"blue\"> <B>Error : </B><BR><HR> "+
    "<FONT SIZE=3 COLOR=\"black\">"+mex.toString()+"<BR><HR>";
    } catch (Exception e) {
    // If here, then error in sending Mail. Display Error message.
    l_result = l_result + "<FONT SIZE=4 COLOR=\"blue\"> <B>Error : </B><BR><HR> "+
    "<FONT SIZE=3 COLOR=\"black\">"+e.toString()+"<BR><HR>";
    e.printStackTrace();
    }//end catch block
    //finally {
    System.out.println(":::::::::::::::::::::::::::::::::"+l_result);
    return l_result;
    } // end of method send
    } //end of bean
    plz help me

  • 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 update the sent mail using SO_NEW_DOCUMENT_ATT_SEND_API1

    I have a requirement to update/ append the sent mail like a trail.Since i am sending mails using SO_NEW_DOCUMENT_ATT_SEND_API1, how can i update new contents to sent mails using this RFC???Please help me.

    you may have to store content of each time mail send then only, you can send with history.

  • How can I have the title of the document be in the email subject line automatically when sending?

    How can I have the title of the document be in the email subject line automatically when sending?

    It can be done if you use a script, like this one:
    this.mailDoc({cTo: "[email protected]", cSubject: this.title});

  • Sending e-mail using Mail on a new AT&T modem

    Since installing a new AT&T (Motorola) DSL modem, I cannot send e-mail using Apple Mail. AT&T tells me that it is a known issue with Apple, and that they will put me on "the list" for Apple to contact me. Has anyone gotten any satisfaction on this issue? Thank you. 

    I have experience the same email-related problem on both my new MacBook Pro and my iPod Touch.
    - There are also times when I will start one or the other device and get a message on the screen that reads, in effect, that another device is using the connection and cannot connect the second. (I thought mutliple devices could use the connection at the same time as long as they had the router's password.)
    - In addition, the connection will frequently disconnect, and I have to restart the modem to reconnect.
    - I have recently installed an Apple Airport Express router (which works just fine), and subsequently had to replace the modem. That's when the troubles started.

  • What has happened to the rotating disk when sending e-mails in 6.2?

    What has happened to the rotating disk when sending e-mails in 6.2?

    Fast user switching is on... I use the Name reference but I've tried switching to icon with the same result. If the a account I'm switching to is not logged in I get a blank Blue screen for about 2 seconds then the desktop of the account. If the account is already logged in then from the login window (all accounts have passwords) it just switches directly to the desktop.
    I have spaces turned on on my main account however none of the other accounts do, the same thing happens regardless of which account you are switching from or to.
    If you hadn't said it was working for you I would have believe they just pulled it from Leopard.

  • Cannot send e-mail using webmail or Thunderbird

    Since I was instructed to change my account password and walked through the person with a customer service rep a few weeks ago, I have been unable to send e-mail using Thunderbird.  Now, for the last week, I have been unable to send e-mail through Verizon Online (webmail).  I seem to be receiving e-mail normally online.  Also, I have 3 subaccounts that are working normally.
    Any suggestions (other than the ones on the support website--I've followed all those suggestions and changed all those setting, but nothing has worked) would be appreciated.  Thanks!

    beakersgirl13 wrote:
    Since I was instructed to change my account password and walked through the person with a customer service rep a few weeks ago, I have been unable to send e-mail using Thunderbird.  Now, for the last week, I have been unable to send e-mail through Verizon Online (webmail).  I seem to be receiving e-mail normally online.  Also, I have 3 subaccounts that are working normally.
    Any suggestions (other than the ones on the support website--I've followed all those suggestions and changed all those setting, but nothing has worked) would be appreciated.  Thanks!
    What error are you getting when attempting to send through webmail?
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • Can't send E-mails using Outlook Express on WRT300N

    Hello, I searched through the forums to find problems similar to mine, but everyone had a different router than mine, plus none of the solutions worked for me.
    I just purchaced and installed my router yesterday. Since the install, I have not been able to send e-mails using Outlook Express, but I do recieve e-mails. I am using the WRT300N Wireless-N Router.
    Trying to get my local news service up and running, and right now, e-mail communication is vital........
    Thanks.
    -Ryan French
    Tampa Bay News Online

    Well of course, but the error message says socket error, which doesn't tell how to fix it. Even the Outlook Express help site doesn't give any suggestions to fix anything, other than "Your internet connection has failed," which is not the problem.
    To the disable firewalls suggestion: I did try disabling my firewalls and all of my virus/ e-mail scan software just to check it out. The thing is, I don't see how my Windows XP Firewall, or anything I've been using could be a problem. Right now, because of the error all my sent e-mails are stuck in the outbox, when I disconnect my router and connect everything back up leaving the router out of the picture, the e-mails are sent out as normal. This problem only occurs with the router connected.
    I also need to stream live audio, and I've heard it's a pain using a wireless router...
    Thanks for the suggestions, hopefully someone will provide the winning suggestion so I don't have to call customer service!

  • I can't bring up my contact list when sending E mails, says error code

    At times I can't bring up my contact list when sending E mail. It says contact list error code. I can bring up my contact list when I use internet explorer. Sometimes fire fox crashes for no apparent reason ....

    Firefox doesn't do email, it's a web browser.
    If you are using Firefox to access your mail, you are using "web-mail". You need to seek support from your service provider or a forum for that service.
    If your problem is with Mozilla Thunderbird, see this forum for support.
    [http://www.mozillamessaging.com/en-US/support/] <br />
    or this one <br />
    [http://forums.mozillazine.org/viewforum.php?f=39]

  • 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?

  • 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

Maybe you are looking for

  • Can I run Adobe CS 5 in Mavericks? Yosemite?

    A friend has Adobe CS 5 on disc and would let me use it on my iMac (mid 2011) freshly running Mavericks.  Will this work?  Will it continue to work if I upgrade to Yosemite?  Of course, my rather old software from the first Creative Suite, designed f

  • Exchange 2010 Migration of 200 Users/Force Archiving

    Exchange 2010 Outlook 2007 Here's my situation.  We are migrating 200 mailboxes from our current domain which will be absorbed into another company/organization.  The new organization is putting limits on our users mailboxes of 100 Mb or 5000 items i

  • Transporting objects from SAP BW 3.5 to SAP BI

    Hi Experts, I have SAP BI 7.0 installed on my laptop (C & D Drives) and have SAP BW 3.5 and SAP R/3 4.7 installed on an external hard drive (G). Now I have created a data source in SAP BW 3.5 which i want to migrate to SAP BI 7.0. Could anybody pleas

  • The reason of blocking a queue

    Hi Messages are blocked in Inbound queues of Interation Engine. There are no errors. Just message like - Transaction is written... I have deblocked all queues - it helps. Does anybody know the reason whay messages are blocked in queue?

  • How can I eliminate the weird orange AURA that encompass the sun on my sunrise photos??

    how can I eliminate the distracting orangish AURA that encompass the sun on my sunrise photos