Built-in class for sending e-mail?
Is there a built-in class for sending e-mail in ABAP?
Hello
No that i know...but check this:
*& Report YMAIL
*& uses sap script
REPORT YMAIL.
DATA: ITCPO LIKE ITCPO,
TAB_LINES LIKE SY-TABIX.
Variables for EMAIL functionality
DATA: MAILDATA LIKE SODOCCHGI1.
DATA: MAILPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: MAILHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: MAILBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILREC LIKE SOMLREC90 OCCURS 0 WITH HEADER LINE.
DATA: SOLISTI1 LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
PERFORM SEND_FORM_VIA_EMAIL.
FORM SEND_FORM_VIA_EMAIL *
FORM SEND_FORM_VIA_EMAIL.
CLEAR: MAILDATA, MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
REFRESH: MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
Creation of the document to be sent File Name
MAILDATA-OBJ_NAME = 'TEST'.
Mail Subject
MAILDATA-OBJ_DESCR = 'Subject'.
Mail Contents
MAILTXT-LINE = 'Here is your file, would you check it?'.
APPEND MAILTXT.
Prepare Packing List
PERFORM PREPARE_PACKING_LIST.
BREAK gpulido.
Set recipient - email address here!!!
*MAILREC-RECEIVER = '[email protected]'.
MAILREC-RECEIVER = '[email protected]'.
MAILREC-REC_TYPE = 'U'.
APPEND MAILREC.
Set recipient - email address here!!!
*MAILREC-RECEIVER = 'BGIRALDO'.
*MAILREC-REC_TYPE = 'B'.
*APPEND MAILREC.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = MAILDATA
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = MAILPACK
OBJECT_HEADER = MAILHEAD
CONTENTS_BIN = MAILBIN
CONTENTS_TXT = MAILTXT
RECEIVERS = MAILREC
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
submit rsconn01 with mode = 'INT' and return.
CASE SY-SUBRC.
WHEN 0.
WRITE: / 'Result of the send process:'.
LOOP AT MAILREC.
WRITE: / mailrec-RECEIVER(48), ':'.
IF mailrec-RETRN_CODE = 0.
WRITE 'sent successfully'.
ELSE.
WRITE 'not sent'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'no authorization to send to the specified number of'
WHEN 2.
WRITE: / 'document could not be sent to any of the recipients!'.
WHEN 4.
WRITE: / 'no authorization to send !'.
WHEN OTHERS.
WRITE: / 'error occurred during sending !'.
ENDCASE.
ENDFORM.
Form PREPARE_PACKING_LIST
FORM PREPARE_PACKING_LIST.
CLEAR: MAILPACK, MAILBIN, MAILHEAD.
REFRESH: MAILPACK, MAILBIN, MAILHEAD.
DESCRIBE TABLE MAILTXT LINES TAB_LINES.
READ TABLE MAILTXT INDEX TAB_LINES.
MAILDATA-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( MAILTXT ).
Creation of the entry for the compressed document
CLEAR MAILPACK-TRANSF_BIN.
MAILPACK-HEAD_START = 1.
MAILPACK-HEAD_NUM = 0.
MAILPACK-BODY_START = 1.
MAILPACK-BODY_NUM = TAB_LINES.
MAILPACK-DOC_TYPE = 'RAW'.
APPEND MAILPACK.
Creation of the document attachment
This form gets the OTF code from the SAPscript form.
If you already have your OTF code, I believe that you may
be able to skip this form. just do the following code, looping thru
your SOLISTI1 and updating MAILBIN.
PERFORM GET_OTF_CODE.
LOOP AT SOLISTI1.
MOVE-CORRESPONDING SOLISTI1 TO MAILBIN.
APPEND MAILBIN.
ENDLOOP.
DESCRIBE TABLE MAILBIN LINES TAB_LINES.
MAILHEAD = 'TEST.OTF'.
APPEND MAILHEAD.
Creation of the entry for the compressed attachment
MAILPACK-TRANSF_BIN = 'X'.
MAILPACK-HEAD_START = 1.
MAILPACK-HEAD_NUM = 1.
MAILPACK-BODY_START = 1.
MAILPACK-BODY_NUM = TAB_LINES.
MAILPACK-DOC_TYPE = 'OTF'.
MAILPACK-OBJ_NAME = 'TEST'.
MAILPACK-OBJ_DESCR = 'Subject'.
MAILPACK-DOC_SIZE = TAB_LINES * 255.
APPEND MAILPACK.
ENDFORM.
Form GET_OTF_CODE
FORM GET_OTF_CODE.
DATA: BEGIN OF OTF OCCURS 0.
INCLUDE STRUCTURE ITCOO .
DATA: END OF OTF.
DATA: ITCPO LIKE ITCPO.
DATA: ITCPP LIKE ITCPP.
CLEAR ITCPO.
ITCPO-TDGETOTF = 'X'.
Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'YSEND_MAIL'
LANGUAGE = SY-LANGU
OPTIONS = ITCPO
DIALOG = ' '
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'START_FORM'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'MAIN'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
Close up Form and get OTF code
CALL FUNCTION 'END_FORM'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
MOVE-CORRESPONDING ITCPO TO ITCPP.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = ITCPP
TABLES
OTFDATA = OTF
EXCEPTIONS
OTHERS = 1.
Move OTF code to structure SOLI form email
CLEAR SOLISTI1. REFRESH SOLISTI1.
LOOP AT OTF.
SOLISTI1-LINE = OTF.
APPEND SOLISTI1.
ENDLOOP.
ENDFORM.
Bye Gabriel
Similar Messages
-
How to capture the screen for sending the mail
dear sir,
How to capture the screen for sending the mail .. Is there any funtion module or anyother way ? .. How to do this .. Please tell me..
Regards,
Kumardear sir,
s thats my problem ?
Regards,
kumar -
Slow up loading for sending E mail with attachments
Slow up loading for sending E mail with attachments. It takes a long time to send most attchments. I'm on cable and had no problems prior to changing to Mac.com
You need to start in the app that contains the file that you want to send as an attachment, and use that app's functionality (assuming that it has it) to select the file and connect it to an email - you can't start in the Mail app itself
-
Any BAPI or FM for sending e-mail
Hi All,
Is there a BAPI or FM for sending e-mail.
Regards
Nikhil BansalHi,
try with this FM:
<b>SO_NEW_DOCUMENT_SEND_API1</b>
Reward points for helpful answers.
Best regards,
Gianluca Barile -
Workflow for sending reminder mail to approve pending PO in me28
Hi Experts,
I have a requirement wherein I have to design a workflow to send a mail to the approver if he has not approved the PO in me28.
I don need a workflow for PO approval . Only in the case he forgets to approve a PO for one day he needs to get a mail .
Kindly guide me . Quick help is appreciatedHello,
Design a workflow template which is triggered when the PO is created. Make the template wait for the event 'RELEASED' which is to be triggered once the PO is released. If the event is received, complete the workflow or else, design the deadline monitoring to send a mail to the concerned person if PO is not released.
You need to take care of the event creation after the PO is released and deadline monitoring of the step in the workflow template.
If this is not possible, you can create a program which collects all the POs which are not released within a day of creation and send a mail to the concerned people from the program itself. You have to schedule this program daily at a particular time to send the mail. You do not need a workflow for this.
Hope this will help.
Thanks,
Samson -
Looking for .XSD for mail for sending the mail through mail adapter
Hi Experts,
I am looking for .XSD file for sending mail.I am using Mail adapter to send mail to report error occur on creating PO document in my scenario to a specified department's email id.I searched for many blogs but not get any .XSD file for email.Looking for a suugesstion.
Thanks
DeepakDo you have S -user name and password? If not then never mind, Copy the below XSD, I took it from the link which I gave to you.
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://sap.com/xi/XI/Mail/30"
xmlns:xi="http://sap.com/xi/XI/Mail/30"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Mail">
<xs:annotation>
<xs:documentation>Mail package for XI - Mail Adapter</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Subject" type="xs:string" minOccurs="0"/>
<xs:element name="From" type="xs:string" minOccurs="0"/>
<xs:element name="To" type="xs:string" minOccurs="0"/>
<xs:element name="Reply_To" type="xs:string" minOccurs="0"/>
<xs:element name="Content_Type" type="xs:string" minOccurs="0"/>
<xs:element name="Date" type="xs:dateTime" minOccurs="0"/>
<xs:element name="Message_ID" type="xs:string" minOccurs="0"/>
<xs:element name="X_Mailer" type="xs:string" minOccurs="0"/>
<xs:element name="Content" minOccurs="0">
<xs:annotation>
<xs:documentation>any type</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="encoding" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="MailReceipt">
<xs:annotation>
<xs:documentation>Mail Receipt for XI - Mail Adaper</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Server" type="xs:string"/>
<xs:element name="Format" type="xs:string"/>
<xs:element name="UseMailPackage" type="xs:boolean"/>
<xs:element name="Encoding" type="xs:string"/>
<xs:element name="Subject" type="xs:string" minOccurs="0"/>
<xs:element name="From" type="xs:dateTime" minOccurs="0"/>
<xs:element name="To" type="xs:string" minOccurs="0"/>
<xs:element name="Date" type="xs:dateTime" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema> -
Is There a size limitation for sending e-mail photos
I am using the latest version of MS Entourage and my mail account is with .MAC
Yesterday I highlighted two pictures in iphoto and clicked the e-mail icon but was then unable to send the mail. I got an error message. I deleted one of the phtos and still got the error.
I then discovered the size dialog box and clicked "small" and was able to send one photo.
I can receive mail with up to 20 attached Jpg items, But can't forward the same e-mail message. Is there a size limitation in Entourage or in .mac.
ThanksThere is no such limit with Entourage or Apple's Mail application but email account providers have an overall message size limit for received and sent messages.
.Mac has an overall message size limit of 10 MB for received and sent messages which is a typical limit but I have a few friends and business associates who have a smaller overall message size limit of 5 MB. Although I can send a message that is up to 10 MB in size with my .Mac account, the message will not be accepted by the incoming mail server for the friends and business associates with a 5 MB message size limit.
All files attached to a message must be encoded before being sent and decoded when received. Most email clients such as Entourage and Mail use MIME for attachment encoding/decoding which is the internet standard. A problem with MIME is it isn't very efficient. The encoding process increases the size of the pre-encoded file by roughly 50% of so. A file that is 5 MB in size (pre-encoded) will be roughly 7.5 MB in size due to the encoding process.
What was the exact error message provided? -
Email configuration for sending external mail(GMAIL) from SAP server
Hi
I would like to know the procedure for configuring email server in sap for sending mails to gmail.
Regards
SubhaHi,
The correct (gmail) email id should be maintained against the user in SU01.
Refer the following links for the help on the setup:
http://help.sap.com/saphelp_nw04/helpdata/en/af/73563c1e734f0fe10000000a114084/content.htm
http://wiki.sdn.sap.com/wiki/display/XI/SMTPConfigurationinSAPXI -
Configurations required for sender/reciever mail adapters
Hi,
I am working on a scenario, which involves mail adapter configuration.
Mail Adapter scenarios SAP Exchange Infrastructure:
/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
XI: HTML e-mails from the receiver mail adapter ?
/people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
Sending XI-Content as Mail Attachement with specific Filename
Sending XI-Content as Mail Attachement with specific Filename
Triggering e-Mails to Shared folders of SAP IS-U
/people/sravya.talanki2/blog/2005/08/18/triggering-e-mails-to-shared-folders-of-sap-is-u
I have gone through many threads but i am unable to understand what all configurations need to be done on XI and mail server like SMTP setup and stuff.
Please give me any specific links and share with me any real time problems faced while carrying out such a scenario.
Thanks,
PuneetHi check this,
Spam protection-mail
/people/alessandro.guarneri/blog/2007/03/18/basic-spam-protection-for-xi-mail-adapter
e-mails from the receiver mail adapter /people/natty.gur/blog/2007/03/18/if-it146s-all-about-semantic-make-it-formal
sender mail adapter
/people/natty.gur/blog/2007/03/18/if-it146s-all-about-semantic-make-it-formal
File to Mail
/people/varun.vijh/blog/2007/03/20/report-with-a-graph-an-approach
Dynamic mail address
/people/oliver.mayer/blog/2007/04/06/web-dynpro-java-and-adaptive-rfc-in-action
mail adaptor scenarios
/people/manfred.lutz/blog/2007/03/20/abap-trial-version-for-newbies-part-1-download-and-installation-of-the-trial-version
email reporting
/people/mark.yolton/blog/2007/04/05/teched07-were-making-a-list-and-checking-it-twice
mail attachment
/people/community.user/blog/2007/03/19/todo-ideas
/people/puru.govind/blog/2007/03/19/adding-class-inheritance-programaticallyor-dynamically
Triggering Email from folder /people/santosh.v/blog/2007/03/19/organizational-management
Thanks,
Kalenthirababu.P -
Can I set up a Non .mac Email Pop mail client Alias for sending SMTP mail?
I have a yahoo.com POP mail account - [email protected] When I'm lgged into Yahoo mail, this account can receive and send mail from serveral aliases - [email protected], [email protected], etc.
Using Tiger's mail.app, I can log into the Yahoo smtp server and get all my mail, including mail to the alias names.
I would like to be able to reply from my Mac's mail.app account, using one of the aliases, instead of my POP account name. In other words, I'd like the From field be listed as "[email protected]" and not "[email protected]"
In mail.app (v2.1) is there any way to do this?
Alan Sampson' suggestion doesn't work - when I set the From field to the alias name, it looks like mail tries to login to the yahoo SMTP server under the alias, and it gets rejected.
( - see http://discussions.apple.com/thread.jspa?messageID=2603372� )
Go to Mail > Preferences > Accounts and under the Account Information tab for the primary email account preferences, enter all alias email addresses in the Email Address field for the account separate by a comma.
[email protected], [email protected], [email protected]
MacMini - 1.42 Mac OS X (10.4.7)
MacMini - 1.42 Mac OS X (10.4.6)
MacMini - 1.42 Mac OS X (10.4.7)If Yahoo allows this, it should work. Open Mail Help, type alias in the search box, and read the article titled Adding multiple email alias addresses to an account. Could it be that you're trying to put the aliases in the wrong field (i.e. User Name rather than Email Address)? Or maybe it's Yahoo's SMTP server that doesn't allow you to do this?
-
Configurations required for sender/ reciever mail adapter scenario...
Hi,
I have to work on few mail scenario's i.e, sender and reciever.
Please let me know what all configurations are required in XI server to make the system ready to send and recieve mail like SMTP configurations...
Thanks..Hi,
how to use mail adapter
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9e6c7911-0d01-0010-1aa3-8e1bb1551f05
XI: Dynamic name in the mail attachment - pseudo "variable substitution"
The specified item was not found.
XI: Sender mail adapter - PayloadSwapBean - Step by step
The specified item was not found.
XI: HTML e-mails from the receiver mail adapter ?
The specified item was not found.
Mail Adapter (XI) - how to implement dynamic mail address
The specified item was not found.
S/MIME Security for the MAIL-Adapter within XI
S/MIME Security for the MAIL-Adapter within XI
Configuring sender mail adapter
http://help.sap.com/saphelp_nw04/helpdata/en/23/c093409c663228e10000000a1550b0/frameset.htm
Thanks,
Madhu
Edited by: Madhu sudhan Reddy on Jul 18, 2008 7:54 AM -
Custom Workflow for sending Remainder mail in MS CRM 2013/2015 online
Hi All,
We have a requirement to send a remainder email before 5 days,3 days and on the same day of the M/TC date in lead form. To achieve this we tried using Custom Workflow. Below is the logic tried but in the highlighted line
not able to retrieve the "M/TC date" value, this results in no output.
Kindly suggest where we are going wrong or a best approach to do this.
Parameters:
[RequiredArgument]
[Input("InputEntity")]
[ReferenceTarget("lead")]
public
InArgument<EntityReference>inputlead
{ get;
set; }
[Output("TaskCreated")]
[ReferenceTarget("task")]
public
OutArgument<EntityReference>
taskCreated { get;
set; }
code:
try
Entity lead
= (Entity)service.Retrieve("lead",
context.PrimaryEntityId, new ColumnSet(newString[]
{ "new_mtcdate" })); // (unable to
retrieve the mtcdate)
Guid leadId
= this.inputlead.Get(executionContext).Id;
if(lead.Contains("new_mtcdate"))
{ DateTime date
= DateTime.Now;
DateTime mtcdate
= (DateTime)lead["new_mtcdate"];
TimeSpan elapsed
= date.Subtract(mtcdate);
double days
= elapsed.TotalDays;
Entity task
= new Entity();
task.LogicalName = "task";
if (days
== 5)
{task["subject"]
= "Five days more for the Meeting";
task["regardingobjectid"]=new EntityReference("lead",leadId);
Guid taskId
= service.Create(task);
this.taskCreated.Set(executionContext,new EntityReference("task",
taskId));}
if (days
== 3)
{task["subject"]
= "Three days more for the Meeting";
task["regardingobjectid"]=new EntityReference("lead",leadId);
Guid taskId
= service.Create(task);
this.taskCreated.Set(executionContext,new EntityReference("task",
taskId));}
if (days
== 0)
{task["subject"]
= "Today you have Meeting";
task["regardingobjectid"]=new EntityReference("lead",leadId);
Guid taskId
= service.Create(task);
this.taskCreated.Set(executionContext,new EntityReference("task",
taskId));
Regards, Rekha.JHi,
Try with replacing
Entity lead = service.Retrieve("lead", context.PrimaryEntityId, new ColumnSet(new string[] { "new_mtcdate" }));
also make it confirm, you are getting EntityId.
Also check Link -
Max recipents allowed for sending the mail through FM...
Hi frndz,
i am using the FM ''SO_NEW_DOCUMENT_SEND_API1' to send mails to the recipents, here there is need to send mails to 15,000 recipents will it allow to send...
Thanks
Karthikeyan.Lhi there...
to send mail to a large number of recipients, u should define an organisational structure, and assign a list of users to a role in this org structure and den send mail to this role instead of the entire list.
this will help . reward if it does. -
How can I permanently remove built-in formatting for outgoing e-mail?
Formatting changes during composition of outgoing e-mails. When I change the selection of font and/or font size, the formatting values still change while writing. I would like to permanently disable the default formatting. Can this be done? Thanks.
My mistake my e-mail is not Outlook but is mac mail.
-
Sending automatic mail using JSP or Servlet
hello,
i was just wondering if anyone out there knows how can automatically send emails to client from my application after receiving thier email address. the email address is received from a form and i want my application to automatically send a structured email to the client as soon as they click the send button. i am using JSP and tomcat as my server. any help will be appreciatedYou must create a class that sends the mail:
A code example would be like this:
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.util.*;
public class MailSender {
public void postMail(String smtpsrv, String recipients[], String subject,
String message, String from) throws MessagingException {
boolean debug = false;
//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", smtpsrv);
// create some properties and get the default Session
Session session = Session.getDefaultInstance(props, null);
session.setDebug(debug);
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++) {
addressTo[i] = new InternetAddress(recipients);
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/html;charset=utf-8");
Transport.send(msg);
You 'll find out that its easy to understand the code.
I advise you not to change this code.
I also include an example of how to right the JSP code:
<%
MailSender MS = new MailSender();
try {
MS.postMail(server, recipient,"Your E-mail Title", "BODY content", from);
} catch (MessagingException e1) {
e1.printStackTrace();
%>
This JSP code follows the pattern of the above class
Hope to help you
Cheers!!!
Maybe you are looking for
-
IPhoto 9.2.1 update - no RAW files
This problem is on my husband's MacBook Pro running 10.6.8. Prior to the 9.2.1 update he had uploaded quite a few RAW (NEF) files from his Nikon D90 and they worked fine. After the update, the thumbnails are there, but they cannot be opened to view
-
Help me spend 20k on VDI/Virtualization/all-in-one Cluster. What would you do?
I want to buy hardware for VDI, virtualization and general cloud-services. (hardware will be colocated.) I need some help/advice on my current setup; I already have a (semi-succesfull) IT company, I have a customer base, advertising, cashflow, connec
-
Reduce the tab height in pixels for FF29
I have read all the threads her eon the forums. I have tried the addons. I have googled, and googled and googled. Is there a way to reduce the height of the tabs in terms of pixels or not? I have edited my css file. I have tried the classic theme res
-
My NBA League Pass login cannot be authenticated -- I am in the United States and the same league pass name and password are working for my iPad, but not for my apple tv.
-
Need tech help on partner determination.
Hi Guys, As per the specific business scenario,we have defined one partner determination procedure but we do have two business process in which partner are getting determined from sold to party but other country we determine from ship to party. Note