Beginner help to send an email from PHP

I hope this isn't too easy to answer - I think I must be doing something fairly simple wrong.
I want to send an email from a PHP page, using SOAP so the mail appears in the sender's sent items, as if it was done in the usual way.
We're using Groupwise 8.02
Using the example code in phpClient/phpClient.php I have got a list of folders/emails in my mailbox, so the authentication and access to Groupwise is obviously working. However, in that file there isn't a send mail example, so I copied the one from phpSOAP/client.php and it doesn't work.....the error seems to be 59920 which might be something to do with the session missing, but I find this hard to believe since the folders can be retrieved with the same object.
Here is the code for mail sending I'm using:
$mail = new Mail();
$mail->subject = "php item";
$dist = new Distribution();
$from = new From();
$from->displayName = "Paul Green";
$from->email = "[email protected]";
$dist->from = "[email protected]";;
$dist->to = "Paul Green";
$rlist = new RecipientList();
$recip1 = new Recipient();
$recip1->displayName = "Peter";
$recip1->email = "[email protected]";
$recip2 = new Recipient();
$recip2->displayName = "Andy";
$recip2->email = "[email protected]";
$rlist->recipient = array ($recip1, $recip2);
$dist->recipients = $rlist;
$mail->distribution = $dist;
$mp = new MessagePart();
$mp->_ = "This is a test!";
$mb = new MessageBody();
$mb->part = $mp;
$mail->message = $mb;
$sir = new sendItemRequest();
$sir->item = $mail;
$sires = $gwservice->sendItemRequest($sir);
Looking around, it seems to me that some of the objects haven't got the properties that the above code expects (eg the from object), so is the schema wrong somewhere?
What I would like, but couldn't find, is some simple example code that works!
Does anyone know the simplest way to send an email via SOAP?
Many thanks in advance for any help anyone can give.
Paul Green
Barton Peveril College
Eastleigh
Hampshire
UK

The phpClient code was a proof of concept.
I only hand fixed a few of the requests.
If you use that code, you will need to go into each
request you want to use and put in code to put in the
session string. You need to do that in GroupWiseService.php.
You may need to modify the individual files, ie Filter.php.
The phpSOAP code works better / easier. You shouldn't have
to modify that code. (You should be able to just use it.)
That said, I only did a spot check. The code is as is. There
is no support for it.
Preston
>>> On Friday, June 29, 2012 at 9:56 AM,
PaulGreen77<[email protected]> wrote:
> Thanks for the suggestions. I tried the phpClient code you suggested,
> but it didn't work at all. I don't quite understand what you say about
> setting the session header string; I think my code does this already.
>
> Early on in the code, after logging in, I have the following line
> $gwservice‑>session = $lres['session'];
> Doesn't this set the session as part of the Groupwise service?
>
> You said I need to manually set the session header string, but which
> objects do i need to do it in? And can I do it as a parameter call, or
> does it need to be done in GroupwiseService.php?
>
> I hope this doesn't make me sound too silly, but I am a bit of a novice
> with OO programming!
>
> Another point: at various places in the code,
> http://schemas.novell.com/2005/01/Gr...groupwise.wsdl is referred
> to, but when I type this into a web browser, it says it can't be found?
> Does this matter?
>
> I hope you can help me a bit further!
>
> Thanks.
>
> Paul
>
> Preston Stephenson;2203363 Wrote:
>> If you can use php 3.x, use the phpSOAP example instead.
>> ftp://sdk.provo.novell.com/ndk/gwsoa...rm/phpSOAP.ZIP
>>
>> It will handle setting the session string header automatically.
>> If you use the phpClient example, you will have to go in to
>> GroupwiseService.php
>> and manually set the session header string in each request you want to
>> use.
>> See getFolderListRequest().
>>
>> Preston
>>
>> >>> On Friday, June 22, 2012 at 9:56 AM,
>> PaulGreen77<PaulGreen77@no‑mx.forums.novell.com> wrote:
>>
>> > I hope this isn't too easy to answer ‑ I think I must be doing
>> something
>> > fairly simple wrong.
>> > I want to send an email from a PHP page, using SOAP so the mail
>> appears
>> > in the sender's sent items, as if it was done in the usual way.
>> > We're using Groupwise 8.02
>> >
>> > Using the example code in phpClient/phpClient.php I have got a list
>> of
>> > folders/emails in my mailbox, so the authentication and access to
>> > Groupwise is obviously working. However, in that file there isn't a
>> send
>> > mail example, so I copied the one from phpSOAP/client.php and it
>> doesn't
>> > work.....the error seems to be 59920 which might be something to do
>> with
>> > the session missing, but I find this hard to believe since the
>> folders
>> > can be retrieved with the same object.
>> >
>> > Here is the code for mail sending I'm using:
>> >
>> > $mail = new Mail();
>> > $mail‑>subject = "php item";
>> > $dist = new Distribution();
>> > $from = new From();
>> > $from‑>displayName = "Paul Green";
>> > $from‑>email = "[email protected]";
>> > $dist‑>from = "[email protected]";;
>> > $dist‑>to = "Paul Green";
>> > $rlist = new RecipientList();
>> > $recip1 = new Recipient();
>> > $recip1‑>displayName = "Peter";
>> > $recip1‑>email = "[email protected]";
>> > $recip2 = new Recipient();
>> > $recip2‑>displayName = "Andy";
>> > $recip2‑>email = "[email protected]";
>> > $rlist‑>recipient = array ($recip1, $recip2);
>> > $dist‑>recipients = $rlist;
>> > $mail‑>distribution = $dist;
>> > $mp = new MessagePart();
>> > $mp‑>_ = "This is a test!";
>> > $mb = new MessageBody();
>> > $mb‑>part = $mp;
>> > $mail‑>message = $mb;
>> > $sir = new sendItemRequest();
>> > $sir‑>item = $mail;
>> > $sires = $gwservice‑>sendItemRequest($sir);
>> >
>> > Looking around, it seems to me that some of the objects haven't got
>> the
>> > properties that the above code expects (eg the from object), so is
>> the
>> > schema wrong somewhere?
>> > What I would like, but couldn't find, is some simple example code
>> that
>> > works!
>> > Does anyone know the simplest way to send an email via SOAP?
>> >
>> > Many thanks in advance for any help anyone can give.
>> >
>> > Paul Green
>> > Barton Peveril College
>> > Eastleigh
>> > Hampshire
>> > UK

Similar Messages

  • I cannot send an email from my iPad 2? No problem receiving, why does this happen? Have tried the suggestions for setting up email and after doing the sync mail through iTunes receiving worked great but still cannot send? Any help would be great

    I cannot send an email from my iPad 2? No problem receiving, why does this happen? Have tried the suggestions for setting up email and after doing the sync mail through iTunes receiving worked great but still cannot send? Any help would be great!

    The fact that you can receive means you have a valid e mail address, and have established the connection to the incoming server, so all of that works.  Since the send does not work, that means your outgoing server is rejecting whatever settings you used formthe outgoing set up.  Try them again. 
    Google your particular isp, and ipad and many times you will find the exact settings needed for your isp.  Or tell us here, and soneone else may be on the same isp.  Some mail services need you to change a port, or have a unique name for the outgoing server.  
    Kep trying.

  • I cannot send Yahoo eMail from iPad or iPhone, but I can receive

    I cannot send Yahoo eMail from iPad or iPhone, but I can receive.

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    iPad Mail
    http://www.apple.com/support/ipad/mail/
     Cheers, Tom

  • Sending an email from a servlet

    Hi Guys,
    Im trying to send an email from a servlet. I am using the following code:
    IMPORTING LIBRARIES
    import java.util.*;
    import java.io.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    //importing JDBC
    import java.sql.*;
    //email
    import java.net.*;
    import java.text.*; // Used for date formatting.
    BEGIN CLASS
    public class Email3 extends HttpServlet
         private Socket smtpSocket = null;
         private DataOutputStream os = null;
         private DataInputStream is = null;
    public void doPost (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    PrintWriter out = res.getWriter();
    OUTPUT TAGS FOR WEBPAGE
         out.println("<html>");
    out.println("<head>");
    out.println("<title>FYP</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<center>");
    send email
              //Date dDate = new Date();
              //DateFormat dFormat = _
         //DateFormat.getDateInstance(DateFormat.FULL,Locale.US);
         String m_sHostName="localhost";
         int m_iPort=25;
              try
              { // Open port to server
                   smtpSocket = new Socket(m_sHostName, m_iPort);
                   os = new DataOutputStream(smtpSocket.getOutputStream());
                   is = new DataInputStream(smtpSocket.getInputStream());
                   if(smtpSocket != null && os != null && is != null)
                   { // Connection was made.  Socket is ready for use.
                        out.println("Connection was made. Socket is ready for use.");
                        //[ Code to send email will be placed in here. ]
                        try
                             {   os.writeBytes("HELLO\r\n");
                             // You will add the email address that the server
                             // you are using know you as.
                             os.writeBytes("MAIL From: <[email protected]>\r\n");
                             // Who the email is going to.
                             os.writeBytes("RCPT To: <[email protected]>\r\n");
                             //IF you want to send a CC then you will have to add this
                             os.writeBytes("RCPT Cc: <[email protected]>\r\n");
                             // Now we are ready to add the message and the
                             // header of the email to be sent out.
                             os.writeBytes("DATA\r\n");
                             os.writeBytes("X-Mailer: Via Java\r\n");
                             //os.writeBytes("DATE: " + dFormat.format(dDate) + "\r\n");
                             os.writeBytes("From: Me <[email protected]>\r\n");
                             os.writeBytes("To: YOU <[email protected]>\r\n");
                             //Again if you want to send a CC then add this.
                             os.writeBytes("Cc: CCDUDE <[email protected]>\r\n");
                             //Here you can now add a BCC to the message as well
                             //os.writeBytes("RCPT Bcc: BCCDude<[email protected]>\r\n");
                             String sMessage = "Your subjectline.";
                             os.writeBytes("Subject: Your subjectline here\r\n");
                             os.writeBytes(sMessage + "\r\n");
                             os.writeBytes("\r\n.\r\n");
                             os.writeBytes("QUIT\r\n");
                             // Now send the email off and check the server reply.
                             // Was an OK is reached you are complete.
                             String responseline;
                             while((responseline = is.readLine())!=null)
                             {  // System.out.println(responseline);
                             out.println("responseline= "+responseline+"<br>");
                             if(responseline.indexOf("Ok") != -1)
                                  //out.println("responseline"+responseline);
                             break;
                             catch(Exception e)
                             {  System.out.println("Cannot send email as an error occurred.");
                                  out.println("Cannot send email as an error occurred.");
              catch(Exception e)
              { System.out.println("Host " + m_sHostName + "unknown"); }
              out.println("</center>");
              out.println("</body>");
              out.println("</html>");
              out.close();
    }//end class
    it compiles fine, the connection was made ok but im not receiving the email. When the email is sent off the server reply does not seem to be Ok, as the print statement i tried there is not being executed. When i print the content of my responseline= variable before the if statement i get the following:
    Connection was made. Socket is ready for use. responseline= 220 centaur.elec.qmul.ac.uk ESMTP Exim 3.16 #2 Thu, 09 Jan 2003 15:54:34 +0000
    responseline= 500 Command unrecognized
    responseline= 250 is syntactically correct
    responseline= 550 relaying to prohibited by administrator
    responseline= 500 Command unrecognized
    responseline= 503 No recipient(s).
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 500 Command unrecognized
    responseline= 221 Closing connection. Good bye.
    Can anyone help?
    Is there an easier way to send an email from a servlet?
    Thanks
    tzaf

    It's not a matter of "easier way" to send mail from servlet...you are missing a crucial element in your code: authorization to send mail. You need something like this (some of which you have already so note what is different):
            Properties properties = new Properties();
            properties.put("mail.smtp.host", String3 );
            properties.put("mail.smtp.dsn.notify", "SUCCESS" );
            properties.put("mail.smtp.host", "mailservernamegoeshere");
            properties.put("mail.smtp.auth", "true");
            MyAuthenticator auth = new MyAuthenticator();
            auth.setUser("user whos account you want to use goes here");
            auth.setPassword("user password goes here");
            Session session = Session.getDefaultInstance( properties,auth );Here is the auth class:
    class MyAuthenticator extends Authenticator {
       protected String m_strUser     = null;
       protected String m_strPassword = null;
       protected PasswordAuthentication getPasswordAuthentication()  {
          return new PasswordAuthentication(m_strUser,m_strPassword);
       public void setUser(String strUser)  {
          m_strUser = strUser;
       public void setPassword(String strPassword)  {
          m_strPassword = strPassword;

  • Sending an email from my database

    Hi!
    I wanna send an email from within a procedure from my database, Im thinking of using the utl_smtp package, I know I need acces from my database server to the smtp server, that can be done... when u use the utl_smtp package u need to specify the smtp host, the email address of the sender, the email address of the receptor, and some other stuff, what I wonder is: Where do u specify the password of the email address of the sender?, I mean, it doesnt make sense that u use an email address to send an email and u dont specify the password of that account
    In all the samples Ive seen all over internet I havent found something that tells me something about it...
    Any Help???

    A lot of smtp servers do not require a username/password when sending mail, only when receiving mail.
    If you need verification, you can do it with utl_smtp:
    utl_smtp.command( conn, 'AUTH LOGIN'); 
    utl_smtp.command( conn, utl_raw.cast_to_varchar2( utl_encode.base64_encode( utl_raw.cast_to_raw( cuser ))) ); 
    utl_smtp.command( conn, utl_raw.cast_to_varchar2( utl_encode.base64_encode( utl_raw.cast_to_raw( cpassword ))) ); 

  • Sending an email from Lotus Notes release 5.0.4a

    I need to write java code for sending an email from Lotus Notes release 5.0.4a.
    Initially, I tried using Lotus Domino Toolkit for java, but the current release, "Lotus Domino ToolKit for Java/Corba release 5.0.8" is not compatible with the notes client/server we are using(5.0.4a).
    Now, I am trying to use "Lotus Domino Toolkit 2.1" which supports notes version 5.0.3 and higher, but I couldnot find out how to use it to send email.
    Is there are other way in which we can connect to Lotus Notes for sending email. I cannot use SMTP as the Lotus Notes administrator is afraid of security issues so there is no possibility that I can connect to Domino server using java mail API by enabling SMTP on the Domino server.
    I would be thankful if somebody can help me to do this.

    First off - This is very "off topic"
    The Domino SMTP server is not hard to lock down. Any Notes Admin worth his/her salt should know how to do it. Try to persuade them to run the SMTP stuff using name and password authentication only, or restrict access to an IP address range. This is all easy stuff.
    Otherwise DIIOP/CORBA is one way to go. If your toolkit jar files don't work with the server then try using the ones on the server. Look in %noteshome%\data\domino\java for the ncso.jar file.
    This works for me on an AS/400 java VM to WinNT/Linux Domino servers of various versions.
    How to create an email using this method is again not difficult. All you really need is a blank database template. You have to create a document with certain fields in it (all documented) and then save it. That's all there is to it.
    Word of warning DIIOP is not very rapid and careless coding can create problems. Ensure that once you have finished a session you make sure you close it else you will have continual connection problems.
    Try searching around the domino/notes groups on how to actually do this.
    SH

  • Since upgrading to IOS 8.1.2, I cannot send/receive emails from either of my Apple or Verizon email accounts.  Does anyone know how to fix this problem or how to go back to IOS 8.1.1?

    Since upgrading to IOS 8.1.2 on my iPad3, I cannot send/receive emails from either of my Apple or Verizon email accounts.  I confirmed that my internet connection is working. Does anyone know how to fix this problem or how to go back to IOS 8.1.1?

    Hi Milrclan,
    Thanks for contributing to the Apple Support Communities. 
    If you're not able to send or receive email from the mail accounts on your iPad after updating iOS, start with these troubleshooting tips:
    Get help with Mail on iPhone, iPad, and iPod touch - Apple Support
    Best Regards,
    Jeremy 

  • HT1277 I can send & receive email from my ipad but for some reason I can no longer do this from my i mac.It keeps telling me that the password is not valid with the imap server.I keep entering the password but it won't accept it.

    I can send & receive email from my ipad but for some reason I can no longer do this from my i mac.It keeps telling me that the password is not valid with the imap server.I keep entering the password but it won't accept it.

    Do you have one, two or more entries in the left colum of Mail.app for your mail server(s)?  That is, do you have your Mail.app set up with either a btinternet entry, with a btyahoo entry, or both?  Or more?
    I'm guessing that you might have one account (btyahoo?) listed for incoming (IMAP server) mail, and with the outbound (SMTP server) mail is configured and named btinternet.
    Based on what little I see posted, it looks like BT uses both btinternet and btyahoo, but I'm not exactly clear on how they have their stuff set up, and their web set gets helpful and tries to help configure my mail — I don't immediately see a single web page with the mail server set-up details.  The BT email client set-up starts here.

  • Need to send HTML email from Workflow : problem with sender

    Hi all,
    i need to send HTML email from my Workflow. I did it but i have a problem with the sender. The sender of email is always the agent responsible of workitem, and i don't want the receiver can answer to sender. So i need to put a false email address like nosender.at.mycustomer.com.
    Possible to do that ?
    Thanks for your help.
    Cheers

    Hi rick
    How to change the wf-batch to some other name  as you mention in previous reply. Can you give some details of that. If i use the function module SO_NEW_DOCUMENT_ATT_SEND_API1 how to change the wf-batch name and if i use send mail step in my workflow how to change wf-batch name.
    Regards
    vijay

  • Sending an Email from the app along with table data

    Hi All,
    I would like to send an email from my app. I tried to put in the field attachment SQL this query: select * from Table_Name where id = (select max(id) from Table_Name) but it did not work. It showed me this error:
    1 error has occurred
    Wrong number of columns selected in the SQL query. See Help of attribute for details.
    I would like to send an email every time the user insert a row with that row in the email... How can I do that?
    Thank You.

    What I would suggest is the following:
    Build an After Insert Trigger on the table in question. In this trigger build a string with ALL the columns that are being inserted into the table. Then you will need to build some local variable to submit your mail. You will send your e-mail via UTIL_SMTP mail, since you may NOT always being in an APEX application when the table is updated..
    Ask away if you have more questions..
    Thank you,
    Tony Miller
    Webster, TX
    I am a Ranger! We walk in the dark places no others will enter! We stand on the bridge and no one may pass! We live for the One, we die for the One!
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Sending an Email from within an Oracle Package

    Hi,
    I am trying to send an email from within a Oracle package Body. The code i have to do this is as follows: -
    PROCEDURE send_mail(sender_in IN VARCHAR2,
    recipient_in IN VARCHAR2,
    date_from_in IN VARCHAR2,
    date_to_in IN VARCHAR2) IS
    -- Procedure to send e-mail
    mailhost VARCHAR2(30) := '192.168.2.6';
    crlf VARCHAR2(2) := CHR(13)||CHR(10);
    --message VARCHAR2(32767);
    message LONG;
    mail_conn utl_smtp.connection;
    reply VARCHAR2(512);
    BEGIN
    mail_conn := utl_smtp.open_connection(mailhost, 25);
    message := 'Date: '||TO_CHAR(SYSDATE, 'DD-MON-YY HH24:MI:SS')||crlf||
    'From: <'||sender_in||'>'||crlf||
    'Subject: ''Holiday Request'||crlf||
    'To: '||recipient_in||crlf||
    utl_smtp.helo(mail_conn, mailhost);
    utl_smtp.mail(mail_conn, sender_in);
    utl_smtp.rcpt(mail_conn, recipient_in);
    utl_smtp.data(mail_conn, message);
    utl_smtp.quit(mail_conn);
    EXCEPTION
    WHEN others THEN
    RAISE;
    END send_mail;
    end holidays;
    I have one question though. I am getting a ORA-29278 SMTP Transien Error: 421 Service Nota Available Error. I think this may be due to the 'Mailhost' value I have given in the above code. I have been informed that this should be the ip address of the mail server used or the ip address of the machine if it is being run locally. What would i need to put in here if i wish for an email to be sent from one hotmail address to another for example?
    Any help would be much appreciated!
    Thanks!
    Darren

    hi
    The funnier part is that
    u can actually type in the sender's email id irrespective of the mail host used
    Like @hotmail.com,@yahoo.com etc.
    The receiver will get the mails from the email id that u wrote .
    The problem u r facing is becoz of the incorrect mail host server ip address
    Try to get in touch with the network admin for the mail server ip address
    other way is
    get the name it would be like
    smtp.domain name .
    hope that helps

  • How to send an email from a VI

    Hello..
         I want to know how to send an email from VI. I am using Labview 8.6 . I tried some examples also. But when I run those VIs, I getting errror. It is smtp server error. I dont have any idea about how to change smtp server settings. Can any body tell step by step procedure to accomplish this task.. 
    Further, I need send an attachment with this email... 
    Please help me
    Thanks
    Prashanth
    Solved!
    Go to Solution.

    Hello harold..
               thanks for sending VI. I tried it, but I am getting following error
    Error 1172 occurred at Error calling method System.Net.Mail.SmtpClient.Send of ObjectId handle: 0xCD21184 for obj 0x212E63[System.Net.Mail.SmtpClient] in domain [LabVIEW Domain for Run] and thread 280, (System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
        Inner Exception: System.Net.Mail.SmtpException: Failure sending mail.
        Inner Exception: System.Net.WebException: Unable to connect to the remote server
        Inner Exception: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
    ) in GmailLV86.vi
    How can I solve this problem..
    Please let me know.
    Thanks
    Prashanth

  • Sending novell command from PHP

    Hi,
    I am trying to unzip a file from php.
    I am trying to run a unzip command from phpm but the novell server won't take it.
    when i do: <?php exec("unzip DATA1:/zipfile.zip"); ?>
    i get: unable to find load file SYS:/TMP/UNZIP
    when i do: <?php exec("echo unzip DATA1:/zipfile.zip"); ?>
    i get: unable to find load file SYS:/TMP/ECHO
    when i do: <?php exec("echo unzip "); ?>
    i get: unzip.nlm load status KenelOnly
    Does someone know how to send a command from php to Novell correctly??
    Thank you,

    Have you tried specifying the path with something like
    <?php exec("sys:/system/unzip DATA1:/zipfile.zip"); ?>
    Wolfgang
    "Flex Travel - Higo Rocha Cidario" <[email protected]> wrote in message
    news:oE0uh.7409$[email protected]..
    > Hi,
    >
    > I am trying to unzip a file from php.
    > I am trying to run a unzip command from phpm but the novell server won't
    > take it.
    >
    > when i do: <?php exec("unzip DATA1:/zipfile.zip"); ?>
    > i get: unable to find load file SYS:/TMP/UNZIP
    >
    > when i do: <?php exec("echo unzip DATA1:/zipfile.zip"); ?>
    > i get: unable to find load file SYS:/TMP/ECHO
    >
    > when i do: <?php exec("echo unzip "); ?>
    > i get: unzip.nlm load status KenelOnly
    >
    > Does someone know how to send a command from php to Novell correctly??
    >
    > Thank you,
    >

  • Sending external email from SAP with following requirements...

    Hi All,
           I need to send external emails from SAP by meeting following requirements.
    1) With subject line more than 100 characters.
    2) No attachments, only body which has specific format (blueprint/layout) and would be amended often, hence code shouldn't be touched during amendments.
    3) Should be able to know the success/failure of mail sending at program level.

    Hi,
    The code below demonstrates how to send an email to an external email address
    *& Report  ZSENDEMAIL                                                  *
    *& Example of sending external email via SAPCONNECT                    *
    REPORT  zsendemail                    .
    PARAMETERS: psubject(40) type c default  'Hello',
                p_email(40)   type c default '[email protected]' .
    data:   it_packing_list like sopcklsti1 occurs 0 with header line,
            it_contents like solisti1 occurs 0 with header line,
            it_receivers like somlreci1 occurs 0 with header line,
            it_attachment like solisti1 occurs 0 with header line,
            gd_cnt type i,
            gd_sent_all(1) type c,
            gd_doc_data like sodocchgi1,
            gd_error type sy-subrc.
    data:   it_message type standard table of SOLISTI1 initial size 0
                    with header line.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Perform populate_message_table.
    *Send email message, although is not sent from SAP until mail send
    *program has been executed(rsconn01)
    PERFORM send_email_message.
    *Instructs mail send program for SAPCONNECT to send email(rsconn01)
    perform initiate_mail_execute_program.
    *&      Form  POPULATE_MESSAGE_TABLE
          Adds text to email text table
    form populate_message_table.
      Append 'Email line 1' to it_message.
      Append 'Email line 2' to it_message.
      Append 'Email line 3' to it_message.
      Append 'Email line 4' to it_message.
    endform.                    " POPULATE_MESSAGE_TABLE
    *&      Form  SEND_EMAIL_MESSAGE
          Send email message
    form send_email_message.
    Fill the document data.
      gd_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      gd_doc_data-obj_langu = sy-langu.
      gd_doc_data-obj_name  = 'SAPRPT'.
      gd_doc_data-obj_descr = psubject.
      gd_doc_data-sensitivty = 'F'.
    Describe the body of the message
      clear it_packing_list.
      refresh it_packing_list.
      it_packing_list-transf_bin = space.
      it_packing_list-head_start = 1.
      it_packing_list-head_num = 0.
      it_packing_list-body_start = 1.
      describe table it_message lines it_packing_list-body_num.
      it_packing_list-doc_type = 'RAW'.
      append it_packing_list.
    Add the recipients email address
      clear it_receivers.
      refresh it_receivers.
      it_receivers-receiver = p_email.
      it_receivers-rec_type = 'U'.
      it_receivers-com_type = 'INT'.
      it_receivers-notif_del = 'X'.
      it_receivers-notif_ndel = 'X'.
      append it_receivers.
    Call the FM to post the message to SAPMAIL
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           exporting
                document_data              = gd_doc_data
                put_in_outbox              = 'X'
           importing
                sent_to_all                = gd_sent_all
           tables
                packing_list               = it_packing_list
                contents_txt               = it_message
                receivers                  = it_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.
    Store function module return code
      gd_error = sy-subrc.
    Get it_receivers return code
      loop at it_receivers.
      endloop.
    endform.                    " SEND_EMAIL_MESSAGE
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
          Instructs mail send program for SAPCONNECT to send email.
    form initiate_mail_execute_program.
      wait up to 2 seconds.
      if gd_error eq 0.
          submit rsconn01 with mode = 'INT'
                        with output = 'X'
                        and return.
      endif.
    endform.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • I have problem send any email from iPad2

    I have a very weird situation.
    I had this iPad2 for  a few months and was able to receive and send email using 3 email accounts, from gmail, yahoo and hotmail without any problem.
    Howeverm after I came back from a trip, I could only receive email, but cannot send any email from any of these accounts at all!
    I am using WIFI. I have deleted all email accounts, turned off the ipad2, and started over a couple of times.
    I tried to recreate these account again one by one. After added one account, I tested it only to see no email can be sent!
    THere is no error message, no any information. All I know is the email I sent from my iPad disappeared!
    Any one here can help?
    Thanks!

    Disabling email scanning didn't fix it. I can open the Mozilla email client and it immediately tries to connect to the inbound AT&T mail server but then just sits there with no response. If I try to send a message same thing, tries to connect to outbound AT&T server but nothing. One of the options in the support doc said to remove the saved passwords and when the client restarts it will ask you to save your password again. The client never makes a connection to the server so it never has a chance to authenticate. Its almost like AT&T disabled their POP server.

Maybe you are looking for

  • Data loading from ODS to CUBE

    Hi All, I have loaded data from ODS to CUBE. now i have requirement to add some fields in the standard cube. so, for testing purpose i have created copy of the original and created transformation . now when i try to load data from ODS it shows me no

  • ADF_FACES-60032:Could not find ExtendedRenderKitService

    Good Day All, I have a problem when i try to run ADF on Websphere server , steps that i did : 1 - Install ADF runtime 11.1.1.4 on Websphere 7.1.1.13 2 - Create ADF page that just contains ADF label and ADF text field 3- deploy ADF war file on Websphe

  • My screen don't show some colors

    Hi I have a weird problem with my colors. I have a mail-box,and new mails have a different color. But this color cant be showing by my screen,,,,it looks like the old mails I have already. When I go to another computer with a LCD screen the color is

  • Rebel T3 not compatible with Windows 8

    My 2012 Rebel T 3 is not compatible with a newly purchased Toshiba laptop with Windows 8.  What can I do to "fix" this?

  • Interactive Form Issues

    Hi, In general my application is as following with tow Views: 1- After the use enter the search criteria in View1 and click Preview Button. 2- View2 open PDF file. 3- In View2 I have a Interactive form to open PDF. My Issues are: 1- After I go and ru