How to send mail in PL/SQL using exchange server details.
Hi Experts,
Business user has provided us the exchange server details to send mails.How can I send mails thru PL/SQL using exchange server details.
user595740 wrote:
Business user has provided us the exchange server details to send mails.How can I send mails thru PL/SQL using exchange server details.Basic answer - not easily.
Oracle supports the standard application protocol SMTP - it does not support a proprietary protocol like that used by Exchange that only works on the Windows operating system. It however provides you with the flexibility to code this yourself.
If you for example use Microsoft MAPI (Mail Application Programming Interface), you can integrate it with PL/SQL using the external procedure (extproc) feature of Oracle.
In a nutshell, extproc enables you to create PL/SQL wrappers for public DLL calls. I posted sample code that demonstrates this in {message:id=2271919}. The sample code is for calling a DLL interface on HP-UX, but the concept is identical on Windows.
Similar Messages
-
How to send mails to multiple recipents using SO_DOCUMENT_SEND_API
Hi ,
I am using the FM "SO_DOCUMENT_SEND_API".
I am able to send an Excel sheet as attachement, but my requirement is to send multiple mails to the corresponding persons. I tried using coma, colan, semi colan as the separator in the import parameter SENDER_ADDRESS for two different mail id's but it was not useful.
I need to send mails to multiple recipens using the same FM. (keeping one person in to list and two of the persons in CC.)
can any on throw some light on this.
Thanks
rewards will be great.....................................Hi,
The code below demonstrates how to send an email to an external email address([email protected]),
where the data is stored within a .xls attachment.
Instead of the statement, <b>PARAMETERS: p_email TYPE somlreci1-receiver
DEFAULT '[email protected]'.</b>,
use select-options & give the e-mail addresses that you want.
*& Report ZEMAIL_ATTACH *
*& Example of sending external email via SAPCONNECT *
REPORT ZEMAIL_ATTACH .
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver
DEFAULT '[email protected]'.
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
wa_charekpo-aedat wa_charekpo-matnr
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
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.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY
Hope this helps.
Reward if helpful.
Regards,
Sipra -
How to send mail in HTML format using SMTP
I want to send mail in HTML format using SMTP.Can anybody please suggest how to do it.Can anybody send me the code.
Thnx.If you don't know how to send a message using JavaMail see here : http://developer.java.sun.com/developer/onlineTraining/JavaMail/contents.html#JavaMailSending
To send a html format mail you need to set the content type like this (msg is a javax.mail.internet.MimeMessage) :
String subject = "An Email 4 U";
String message = "<HTML><BODY>Here is a link<br><a href='http://javasoft.com'>Java</a></BODY></HTML>";
msg.setSubject(subject);
msg.setContent(message, "text/html");p.s This isn't really an advanced topic -
Sender mail adapter config for MS Exchange Server
Dear All Gurus,
Need your advice on configuring sender mail adapter (mail to file scenario ) for exchange server. I have read a lot of SCN threads and other articles and was not able to find the exact solution for this. PI version : 7.3.
Thank you all in advance...Hi,
please check the below links.
http://wiki.scn.sap.com/wiki/display/XI/Step+by+Step+Mail+To+File+Scenario - Mail to File
http://www.riyaz.net/sap/xipi-configuring-the-sender-mail-adapter/90/
Regards
srinivas -
How to send mail in PL/SQL?
Hi:
I want to send email in PL/SQL in linux.
Could anybody tell me how to do it?
By the way,what is DBMS_MAIL? Can I use
it and how to use?
Thanks!
BEST REGARDS!
Sherwin
nullThere's also a really nice discussion on this over at askTom
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:255615160805
Justin -
Send mail with TLS to MS exchange server
Hi,
last month I enabled an oracle wallet TDE for creating encription for TS.
Today, development team needs to send mail to exchange server with TLS.
So I found this procedure on oracle support Doc ID 1323140.1
My question is, can I use the same wallet to send mails from db?
The Oracle Database 11.2.0.3
Or I need to implement a different type of wallet with certificate?
Is there, in this case, a procedure step by step?
I have never implemented that and I'm very confused....
Thanks in advancedHi,
For questions about the wallet set up you should try either -
Database Security - General
or
General Database Discussions
or perhaps the PL/SQL form as you are trying to follow one of their notes -
PL/SQL
Regards,
Mike -
How to send mails to dynamic receivers using XSLT mapping
Hi All,
I have a problem with the mail attributes in xslt mapping. I have a condition on a source field, based on which the "TO" attribute should vary.
For Example : If ROOT/HEADER/XYZ = 001 then receiver should be some abc email id
If ROOT/HEADER/XYZ = 002 then receiver should be
pqr email id.
Can anyone help me out of this
Thanks in advance.
Regards,
Lakshmi.Hi Lakshmi,
you have to create an appropriate mapping for this. As said, the mentioned mail package format will be your message. The message will be analyzed by the mail adapter and after this the TO field will be filled with the correct value you will use. The structure inserted into the content fields will be send in the mail body or, if set in the configuration, as an attachement of the mail (as far as i know (-; )
Example:
Original structure:
<ContentStructure>
<ValueA>ID1</ValueA>
<ValueB>XYZ</ValueB>
</ContentStructure>
Extract of an XSLT-Mapping (as an example, you can use the mapping type you prefer):
<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
<Subject>Subject</Subject>
<From>namea(at)company.com</From>
<To>
<xsl:choose>
<xsl:when test="ContentStructure/ValueA='ID1'">
nameb(at)companyb.com
</xsl:when>
<xsl:when test="ContentStructure/ValueA='ID2'">
namec(at)companyc.com
</xsl:when>
</xsl:choose>
</To>
<Reply_To />
<Content_Type>text/plain</Content_Type>
<Content>
This is the content.
</Content>
</ns:Mail>
If you try something like this, you will be able to set the TO email address dynamical.
Rregards,
Lars -
How to send mail to a person using BSPs?
Hi Group,
I have a requirement for developing a BSP application for "Expenses" claim.
Thing is that, the person will enter some details like (start date, end date,Expenses occured by him and etc.,) and presses a button (<b>Accept</b>).
When he presses the "<b>Accept</b>" button, an Email has to be sent to the Approver of the Expenses.
Could you please let me know how I can achieve this requirement?
Thanks in advance.
Regards,
Vishnu.Hi,
Pls check /people/eddy.declercq/blog/2006/04/03/unknown-thus-unloved
Eddy
PS. Reward the useful answers and you will get <a href="http:///people/baris.buyuktanir2/blog/2007/04/04/point-for-points-reward-yourself">one point</a> yourself! -
How to send mail through java program in solaris server
hi
i am writing java code to send the mail using my company SMTP
,the program is working fine when i run and deploy in windows environment
but at the same time when i deploy the war to sun solaris server ,it is not working
and throwing the Error saying
java.lang.Exception: Invalid Addresses; nested exception is: javax.mail.SendFailedException: 553 sorry, that domain isn't allowed to be relayed thru this MTA without authentication #5.7.1 at jsp.SendMail._jspService(_SendMail.java:137)
i am using the Authentication also using user id and password of same domain and it is able to authenticate
in windows but not in Solaris
where i am making mistake plz
guide.
Saurabhthanks Alan
but i think there is some other problem because same code is
working when i am using in windows as well as i am using authentication method
also but it is not working when running in Solaris Environment
here is the code i am using to send the mail
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "smtp.mycompany.com");//smtp protocol for IIBF
props.put("mail.smtp.starttls.enable","true");//setting start TLS to be true
props.put("mail.smtp.auth", "true");// authentication is false
props.put("mail.smtp.port", port);//setting the port number it can be either 25 or 587
props.put("mail.smtp.username", "noreply");
props.put("mail.smtp.password","noreply");
props.put("mail.debug", "true");
Authenticator auth = new SMTPAuthenticator();
Session session1 = Session.getDefaultInstance(props);
java.util.Properties sessionProperties = new java.util.Properties();
sessionProperties.put("mail.smtp.auth", "true");
message.setFrom(new javax.mail.internet.InternetAddress(From ,"name"));
message.addRecipient(javax.mail.Message.RecipientType.TO, new javax.mail.internet.InternetAddress(To));
message.setText(TextCo);
message.setSubject(subject);
message.setContent(boyd, "text/plain");
message.reply(true);
Transport trans = session1.getTransport("smtp");
trans.connect(SMTP_HOST_NAME, SMTP_AUTH_USER, SMTP_AUTH_PWD);
boolean ddd = trans.isConnected();
message.saveChanges();
trans.sendMessage(message, message.getAllRecipients());
above code is working properly in windows but not in Solaris
plz guide what next to do
thankx in advance
saurabh -
Mail content does not load in Apple Mail 10.8.2 using exchange server
About 10 am this morning Apple Mail stopped working. Initially, no emails could be sent or received even though connection doctor found nothing wrong with the internet connection. At 4pm, email would load but with just the sender and the subject - no content will load. Is anyone else having this problem with Mail?
http://support.apple.com/kb/ht4889
Migration from Mac OS X v10.4 Tiger to OS X Lion
Migration from Mac OS X v10.4 computers to OS X Lion over your Wi-Fi or a wired network is not supported. However, if both Macs are equipped with a FireWire port, you can use Target Disk Mode to transfer your data:
Verify that both Macs are equipped with a FireWire port. Note that different model Macs may have different FireWire connectors, which will require an appropriate cable, such as FireWire 400 to FireWire 800.
On the Mac you want to transfer data from, Restart, and immediately hold the T key.
Wait for the FireWire logo to appear on the screen. If it does not, restart and try again.
Connect both Macs via the FireWire cable.
On the Mac you want to transfer data to, Open the Migration Assistant application.
Select the option "From another Mac, PC, Time Machine backup, or other disk" and click Continue.
Select the option "From a Time Machine backup or other disk" and click Continue.
Select your other Mac's volume, such as "Macintosh HD", from the list, and click Cont
EDIT: Actually I realize you did follow these directions and if your drive is seen on the new Mac it should work. You're entitled to free Apple support with the new purchase, I'd give them a call. -
How can send mails using hotmail/rediffmail domain name?
I have used the below code to send a mail using javamail API?Even when I am sending my application does not have notified any of error/exceptions,But the message is not reached to I have given receipient's address in the to field.
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class Sendmail1 extends HttpServlet {
private String smtpHost;
// Initialize the servlet with the hostname of the SMTP server
// we'll be using the send the messages
public void init(ServletConfig config)
throws ServletException {
super.init(config);
smtpHost = config.getInitParameter("smtpHost");
//smtpHost = "sbm5501";
smtpHost = "www.rediffmail.com";
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException, java.io.IOException {
String from = request.getParameter("from");
String to "[email protected]";
String cc = "[email protected]";
String bcc ="[email protected]";
String smtp ="www.rediffmail.com";
String subject = "hai";
String text = "Hai how r u";
PrintWriter writer = response.getWriter();
if (subject == null)
subject = "Null";
if (text == null)
text = "No message";
String status;
try {
// Create the JavaMail session
java.util.Properties properties = System.getProperties();
if (smtp == null)
smtp = "www.rediffmail.com";
properties.put("mail.smtp.host", smtp);
Session session = Session.getInstance(properties, null);
//to connect
//Transport transport =session.getTransport("smtp");
//transport.connect(smtpHost,user,password);
// Construct the message
MimeMessage message = new MimeMessage(session);
// Set the from address
Address fromAddress = new InternetAddress(from);
message.setFrom(fromAddress);
// Parse and set the recipient addresses
Address[] toAddresses = InternetAddress.parse(to);
message.setRecipients(Message.RecipientType.TO,toAddresses);
Address[] ccAddresses = InternetAddress.parse(cc);
message.setRecipients(Message.RecipientType.CC,ccAddresses);
Address[] bccAddresses = InternetAddress.parse(to);
message.setRecipients(Message.RecipientType.BCC,bccAddresses);
// Set the subject and text
message.setSubject(subject);
message.setText(text);
Transport.send(message);
//status = "<h1>Congratulations,</h1><h2>Your message was sent.</h2>";
} catch (AddressException e)
status = "There was an error parsing the addresses. " + e;
} catch (SendFailedException e)
status = "<h1>Sorry,</h1><h2>There was an error sending the message.</h2>" + e;
} catch (MessagingException e)
status = "There was an unexpected error. " + e;
// Output a status message
response.setContentType("text/html");
writer.println("<title>sendForm</title><body bgcolor= ><b><h3><font color=green><CENTER>CALIBERINFO.COM</CENTER></h3>Your message was sent to recepient(s).<br><font color=red>"+"\n"+to);
writer.println("<br><br><a href=e:/mail/javamail/mail.html>back to compose</a>");
writer.close();
Please any one help me out from this probs.
Awaiting for yours reply,
or give me a reply to: [email protected]
Regards,
@maheshkumar.kHi,
how can send mails using hotmail/rediffmail domain name?In your java application,you specified www.rediffmail.com as your
smtp server.But that is the address of that website.Try will a smtp
server instead.For a list of free smtp servers,please visit http://www.thebestfree.net/free/freesmtp.htm
Hope this helps.
Good Luck.
Gayam.Srinivasa Reddy
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers/support/ -
How to send mail in APEX 4.1 using PLSQL
Hi All,
How to send mail in APEX 4.1 using PLSQL?
Thanks In advance.
Regards
Shailhttp://lmgtfy.com/?q=oracle+apex+4.1+send+mail
-
hi,
I am working in oracle9i and linux 2.4. I need to send a mail from pl/sql along with attachments.
I wrote a pl/sql procedure about how to send a mail with out attachments..
but i want to send a mail from pl/sql along with (csv )attachments ..
That file we have to retrive it from the Directory in the database and to send it through pl/sql using smtp configuration....
RegsAPC,
When I was making use of your sample on OTN that is called 'demo_mail.sql', I got these issues (when compiling the package header against one 10g DB)
21/19 PL/SQL: Declaration ignored
21/65 PLS-00201: identifier 'UTL_TCP' must be declared
22/19 PL/SQL: Declaration ignored
23/47 PLS-00201: identifier 'UTL_TCP' must be declared
47/3 PL/SQL: Declaration ignored
52/16 PLS-00201: identifier 'UTL_SMTP' must be declared
55/3 PL/SQL: Declaration ignored
55/46 PLS-00201: identifier 'UTL_SMTP' must be declared
60/3 PL/SQL: Declaration ignored
60/49 PLS-00201: identifier 'UTL_SMTP' must be declared
64/3 PL/SQL: Declaration ignored
64/45 PLS-00201: identifier 'UTL_SMTP' must be declared
72/3 PL/SQL: Declaration ignored
72/52 PLS-00201: identifier 'UTL_SMTP' must be declared
81/3 PL/SQL: Declaration ignored
81/54 PLS-00201: identifier 'UTL_SMTP' must be declared
95/3 PL/SQL: Declaration ignored
95/57 PLS-00201: identifier 'UTL_SMTP' must be declared
102/3 PL/SQL: Declaration ignored
102/47 PLS-00201: identifier 'UTL_SMTP' must be declared
Bst Rgds,
HuaMin -
Send mail to non-sap using bapi's
hi friends,
Can any one please help me how to send mail from sap to non-sap systems using bapi's.plesae help me .i want the procedure and code
regards
srikanth.vHi,
Use this sample Code...
REPORT ZSENDMAIL.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
Creation of the document to be sent
File Name
DOC_CHNG-OBJ_NAME = 'SENDFILE'.
Mail Subject
DOC_CHNG-OBJ_DESCR = 'Send External Mail'.
Mail Contents
OBJTXT = 'Minimum bid : $250000'.
APPEND OBJTXT.
OBJTXT = 'A representation of the pictures up for auction'.
APPEND OBJTXT.
OBJTXT = 'was included as attachment.'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Creation of the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
Creation of the document attachment
(Assume that the data in OBJBIN is in BMP format)
*OBJBIN = ' \O/ '. APPEND OBJBIN.
*OBJBIN = ' | '. APPEND OBJBIN.
*OBJBIN = ' / \ '. APPEND OBJBIN.
*DESCRIBE TABLE OBJBIN LINES TAB_LINES.
*OBJHEAD = 'PICTURE.BMP'.
*APPEND OBJHEAD.
Creation of the entry for the compressed attachment
*OBJPACK-TRANSF_BIN = 'X'.
*OBJPACK-HEAD_START = 1.
*OBJPACK-HEAD_NUM = 1.
*OBJPACK-BODY_START = 1.
*OBJPACK-BODY_NUM = TAB_LINES.
*OBJPACK-DOC_TYPE = 'BMP'.
*OBJPACK-OBJ_NAME = 'PICTURE'.
*OBJPACK-OBJ_DESCR = 'Representation of object 138'.
*OBJPACK-DOC_SIZE = TAB_LINES * 255.
*APPEND OBJPACK.
Completing the recipient list
RECLIST-RECEIVER = '[email protected]'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
*RECLIST-RECEIVER = 'SAPUSERNAME'.
*RECLIST-REC_TYPE = 'P'.
*APPEND RECLIST.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
WRITE: / 'Result of the send process:'.
LOOP AT RECLIST.
WRITE: / RECLIST-RECEIVER(48), ':'.
IF RECLIST-RETRN_CODE = 0.
WRITE 'The document was sent'.
ELSE.
WRITE 'The document could not be sent'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'No authorization for sending to the specified number',
'of recipients'.
WHEN 2.
WRITE: / 'Document could not be sent to any recipient'.
WHEN 4.
WRITE: / 'No send authorization'.
WHEN OTHERS.
WRITE: / 'Error occurred while sending'.
ENDCASE.
in this code....Internal table IF RECLIST-RETRN_CODE is not 0,then the mail is not send to the recipient, so if you want the undeliverable mail for a perticular recipient then call the same function module SO_NEW_DOCUMENT_ATT_SEND_API1 with undeliverd message to whom want to receive the undeliverd message.
hope this solves your problem -
How to send mail to distribution list ?
Hi Everybody,
Pls let me know how to send mail to distributed list???
Thanks & Regards,
raju<b></b>Hi ,
Use Function Module 'SO_NEW_DOCUMENT_SEND_API1'.
U need to pass Distribution list to Receiver and 'C' to receiver type refer the below code for clarification.
Determine the Distribution List.
gv_rec_list-receiver = gv_distribution.
gv_rec_list-rec_type = 'C'.
APPEND gv_rec_list.
Check if Distribution List is deleted.
SELECT SINGLE objnam
FROM soid
INTO lc_objnam
WHERE objnam = gv_rec_list AND
dlitp = lc_dli.
IF sy-subrc = 0.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = gv_doc_data
document_type = 'RAW'
put_in_outbox = 'X'
TABLES
object_content = gv_obj_cont
receivers = gv_rec_list
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4.
CASE sy-subrc.
WHEN '1'.
message i001(as) with 'TOO MANY RECEIVERS'.
EXIT.
WHEN '2'.
message i001(as) with 'DOCUMENT NOT SENT'.
EXIT.
WHEN '3'.
message i001(as) with 'DOCUMENT TYPE DOES NOT EXIST'.
EXIT.
WHEN '4'.
message i001(as) with 'OPERATION NO AUTHORIZATION'.
EXIT.
ENDCASE.
Hope this might have helped you.
Thanks,
Prashanth
Maybe you are looking for
-
Reinstall a MacBook Pro with a dead graphics card?
I have a 2007 MacBook Pro 17 Inch. Its graphics card died. I want to do a clean install of OS X Mavericks. However, if I do this, screen sharing will go off, and I will be blind during the installation. How can I do a clean install? If I connnect the
-
My code was iterating thru a PDFs content to find certain text and make that text a variable named "title". Then when I printed the pages to AdobePDF I used "title" as the szTempTitle. It worked great printing the two pages and naming the file whatev
-
Table Format order and visibility in Form Settings keeps changing
Dear Experts, We are facing a concurrent problem where there is constant change in the table format of the form settings in marketing documents. The columns order keeps changing and also the visibility box which will be ticked, becomes again unticked
-
New feature in iOS 6.1 + iTunes Match + Car systems
I'm happy to see some great new features with iOS6.1 with iTunes Match when connected to my Audi MMI (music system). Previously if you were a subscriber to Apple's iTunes Match offering, you were able to only see the music tracks that you had manuall
-
HT1848 where is the "store menu" located so I can "authorize this computer"
Where is the "store menu" located so I can "authorize this computer"