How to send a mail thru Oracle
Hello Every one ,
Can u plz tell me the way to send a mail thru oracle...................
Follow the below steps..........
INTRODUCTION:
This bulletin explains how to programmatically send a fax/email message from a
Forms/Reports application via Microsoft Exchange without any kind of user
interaction. It shows the general usage of the 'Mail' package as well as a fully
coded Forms sample application.
The concept of OLE (Object Linking and Embedding) automation is used to control
the OLE server application (Microsoft Exchange) using the client application.
The client in this case may be a Developer/2000 Forms or Reports application. It
uses the objects and methods exposed by the OLE Messaging Library which are
much more robust than the MSMAPI OCX controls and allow access to many more MAPI
properties.
Oracle provides support for OLE automation in its applications by means of the
OLE2 built-in package. This package contains object types and built-ins for
creating and manipulating the OLE objects. Some of these built-ins for e.g.
OLE2.create_obj, OLE2.invoke, OLE2.set_property have been extensively used in
the code.
GENERAL USAGE:
The Mail package contains three procedures:
1. Procedure Mail_pkg.logon( profile IN varchar2 default NULL);
Use this procedure to logon to the MS Exchange mail client. The procedure
takes a character argument which specifies the Exchange Profile to use for
logon. Passing a NULL argument to the logon procedure brings up a dialog box
which asks you to choose a profile from a list of valid profiles or create a new
one if it doesn't exist.
2. Procedure Mail_pkg.send(
--------- Recipient IN varchar2,
Subject IN varchar2 default NULL,
Text IN varchar2 default NULL,
Attachment IN varchar2 default NULL
This is the procedure that actually sends the message and attachments, if
any, to the recipient. The recipient may be specified directly as a valid email
address or as an alias defined in the address book. If the message is intended
for a fax recipient then a valid alias must be used that is defined as a fax
address in the address book.
3. Procedure Mail_pkg.logoff;
This procedure closes the Exchange session and deallocates the resources used
by the OLE automation objects.
SAMPLE FORMS APPLICATION:
1. Create the Mail Package using the following two Program Units:
(a) Mail Package Spec
(b) Mail Package Body
Mail Package Spec:
PACKAGE Mail_pkg IS
session OLE2.OBJ_TYPE; /* OLE object handle */
args OLE2.LIST_TYPE; /* handle to OLE argument list */
procedure logon( Profile IN varchar2 default NULL );
procedure logoff;
procedure send( Recp IN varchar2,
Subject IN varchar2,
Text IN varchar2,
Attch IN varchar2
END;
Mail Package Body:
PACKAGE BODY Mail_pkg IS
session_outbox OLE2.OBJ_TYPE;
session_outbox_messages OLE2.OBJ_TYPE;
message1 OLE2.OBJ_TYPE;
msg_recp OLE2.OBJ_TYPE;
recipient OLE2.OBJ_TYPE;
msg_attch OLE2.OBJ_TYPE;
attachment OLE2.OBJ_TYPE;
procedure logon( Profile IN varchar2 default NULL )is
Begin
session := ole2.create_obj('mapi.session');
/* create the session object */
args := ole2.create_arglist;
ole2.add_arg(args,Profile);/* Specify a valid profile name */
ole2.invoke(session,'Logon',args);
/* to avoid the logon dialog box */
ole2.destroy_arglist(args);
End;
procedure logoff is
Begin
ole2.invoke(session,'Logoff');
/* Logoff the session and deallocate the */
/* resources for all the OLE objects */
ole2.release_obj(session);
ole2.release_obj(session_outbox);
ole2.release_obj(session_outbox_messages);
ole2.release_obj(message1);
ole2.release_obj(msg_recp);
ole2.release_obj(recipient);
ole2.release_obj(msg_attch);
ole2.release_obj(attachment);
End;
procedure send( Recp IN varchar2,
Subject IN varchar2,
Text IN varchar2,
Attch IN varchar2
)is
Begin
/* Add a new object message1 to the outbox */
session_outbox := ole2.get_obj_property(session,'outbox');
session_outbox_messages := ole2.get_obj_property(session_outbox,'messages');
message1 := ole2.invoke_obj(session_outbox_messages,'Add');
ole2.set_property(message1,'subject',Subject);
ole2.set_property(message1,'text',Text);
/* Add a recipient object to the message1.Recipients collection */
msg_recp := ole2.get_obj_property(message1,'Recipients');
recipient := ole2.invoke_obj(msg_recp,'add') ;
ole2.set_property(recipient,'name',Recp);
ole2.set_property(recipient,'type',1);
ole2.invoke(recipient,'resolve');
/* Add an attachment object to the message1.Attachments collection */
msg_attch := ole2.get_obj_property(message1,'Attachments');
attachment := ole2.invoke_obj(msg_attch,'add') ;
ole2.set_property(attachment,'name',Attch);
ole2.set_property(attachment,'position',0);
ole2.set_property(attachment,'type',1); /* 1 => MAPI File Data */
ole2.set_property(attachment,'source',Attch);
/* Read the attachment from the file */
args := ole2.create_arglist;
ole2.add_arg(args,Attch);
ole2.invoke(attachment,'ReadFromFile',args);
ole2.destroy_arglist(args);
args := ole2.create_arglist;
ole2.add_arg(args,1); /* 1 => save copy */
ole2.add_arg(args,0); /* 0 => no dialog */
/* Send the message without any dialog box, saving a copy in the Outbox */
ole2.invoke(message1,'Send',args);
ole2.destroy_arglist(args);
message('Message successfully sent');
End;
END;
2. Create a block called MAPIOLE with the following canvas layout:
|-------------------------------------------------------------|
| |
| Exchange Profile: |====================| |
| |
| To: |============================| |
| |
| Subject: |============================| |
| |
| Message: |============================| |
| | | |
| | | |
| | | |
| | | |
| | | |
| |============================| |
| |-----| |
| Attachment: |============================| |SEND | |
| |-----| |
|-------------------------------------------------------------|
The layout contains 5 text-itmes:
- Profile
- To
- Subject
- Message (multiline functional property set to true)
- Attach
and a 'Send' button with the following WHEN-BUTTON-PRESSED trigger:
mail_pkg.logon(:profile);
mail_pkg.send(:to,:subject,:message,:attch);
mail_pkg.logoff;
Similar Messages
-
How a send a mail from Oracle ----- urgent
Hi,
I am working in oracle9i and linux 2.4. i need to a send mail from oracle .Please send the procedure to me in a detail manner.
I am having one procedure .plz check and change if possible...
declare
l_maicon utl_smtp.connection;
begin
l_maicon :=utl_smtp.open_connection('mail.com');
utl_smtp.helo(l_maicon,'mail.com');
utl_smtp.mail(l_maicon,'[email protected]');
utl_smtp.rcpt(l_maicon,'[email protected]');
utl_smtp.data(l_maicon,'From: [email protected]' || utl_tcp.crlf||
'To: [email protected]' || utl_tcp.crlf ||
'Subject: database e-mail option' || utl_tcp.crlf ||
'You have received this mail from database!');
utl_smtp.quit(l_maicon);
end;
Please explain me in detail
Gobi....If I do a Google search on the terms "Oracle mail", this askTom thread is the second hit
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:255615160805
Did you already find this thread? If so, did it not answer your question sufficiently?
Additionally, it would be quite helpful if you would post the results of running the code you posted. You've given no indication whether there is an error, what error might be generated, whether you're not seeing the expected behavior, whether the code crashes your system, etc. That leaves us to guess about what problems you might have between syntax errors, permission problems, configuration problems on the database, configuration problems on the SMTP server, operating system problems, network problems (the list goes on).
Justin -
How to send bulk mail in oracle apps 11i with pdf/Xls attachment
hi,
how to send bulk emails in one go ( aprrox 150-200 emails in one go) with attachment pdf file in oracle apps 11i
thanksI'd use BI Publisher (XML Publisher) Bursting.
Regards,
Gareth
http://garethroberts.blogspot.com
http://www.virtuate.com -
Send bulk mail in oracle apps 11i with pdf/Xls attachment
hi,
I have a task how can i send bulk emails in one go ( aprrox 150-200 emails in one go) in oaracle apps 11 with attachment pdf/xls
thanksDuplicate post.
how to send bulk mail in oracle apps 11i with pdf/Xls attachment
Re: how to send bulk mail in oracle apps 11i with pdf/Xls attachment -
How to send a mail with HTML body from Oracle
Hi Team,
Can somebody guide me how to send a mail with HTML body from oracle.
Here is the piece of code i am trying to send a mail.
procedure SEND_MAIL is
cursor c_1 is select * from table_name;
l_mail_id varchar2(40);
-- ls_mailhost VARCHAR2(64) := Mailhost;
ls_from VARCHAR2(64) := ‘[email protected]’
ls_subject VARCHAR2(200);
ls_to VARCHAR2(64);
l_mail_conn UTL_SMTP.connection;
ls_left_menu_name VARCHAR2(64);
ll_emp_num number(8);
begin
for i in c_1 loop
begin
l_mail_conn := UTL_SMTP.OPEN_CONNECTION('IP');
UTL_SMTP.HELO(l_mail_conn, 'IP');
UTL_SMTP.MAIL(l_mail_conn, LS_FROM);
UTL_SMTP.RCPT(L_mail_conn, LS_TO);
UTL_SMTP.DATA(l_mail_conn,'From: ' ||ls_from || utl_tcp.crlf ||
'To: ' ||ls_to || utl_tcp.crlf ||
'Subject: ' ||ls_subject|| utl_tcp.crlf);
UTL_SMTP.QUIT(l_mail_conn);
exception
when no_data_found then
null;
when others then
RAISE_APPLICATION_ERROR(-20000, 'Failed to send mail due to the following error: ' || sqlerrm);
end;
end loop;
end;
ThnxHi Nicolas!
Have you tried to set "Output Format" for "RAW Text" to HTM in SCOT.
If HTM is missing in your dropdown-list, you could check out table SXCONVERT2. Copy the line with category T/format TXT, and change the format from TXT to HTM. The existing function
SX_OBJECT_CONVERT__T.TXT does not need to be changed. Now you should be able to choose HTM in SCOT. You will probably need som HTML-tags in your text to make it look good.
Hope this helps!
Regards
Geir -
How to send e-mail notification automatically when a record is inserted?
Dear All,
Could anyone kindly tell me how to send e-mail notification automatically when a record is inserted through a form in Oracle Portal Release 2?
Regards,
Ridwan.Hi,
If you are writing a form on a table then you can call the mail API from a database trigger on the table. If it is a form on a procedure, you can make the email call from the procedure. To know more about sending mails from plsql go to
http://www.quest-pipelines.com/newsletter-v2/smtp.htm
Thanks,
Sharmila -
Send e-mail from Oracle 9i (9.2.0.1)
Hi,
Iam using oracle 9iR2(9.2.0.1) on Widows XP Platform. I want to send mail thru oracle 9i(9.2.0.1) database.
for that i got a procedure from net. Also they asked to follow three steps. the steps are
1. Execute the script as sys "D:\Oracle\Ora92\javavm\install\initjvm.sql"
2. Execute the loadjava classfile as
D:\Oracle\Ora92\plsql\jlib>loadjava -f -v -r -u sys/**** plsql.jar
3. Execute the script as sys "$ORACLE_HOME\rdbms\admin\initplsj.sql"
I sucessfully executed the first step, but for the second step i am not able to locate the plsql.jar file in the specified path.
So Please tell me if there is any other method to perform this task
Regards
Prasanta Pramanik.Is there some reason not to use the built-in UTL_SMTP package?
http://www.psoug.org/reference/utl_smtp.html
It has been available since 8.1.7. -
Sending a mail from oracle database
Hi,
I have a requirement to send a mail from oracle database.I use UTL_TCP package for this.Although my procedure is executed successfully,i dont get the mails in my inbox.Please help me to figure out a solution.
Thanks in advance....Hi, you must use UTL_SMTP package for send emails, it has more performance and features for debug. You must look the next code, this is a example for send emails.
DECLARE
c UTL_SMTP.CONNECTION;
PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS
BEGIN
UTL_SMTP.WRITE_DATA(c, name || ': ' || header || UTL_TCP.CRLF);
END;
BEGIN
c := UTL_SMTP.OPEN_CONNECTION('smtp-server.acme.com');
UTL_SMTP.HELO(c, 'foo.com');
UTL_SMTP.MAIL(c, '[email protected]');
UTL_SMTP.RCPT(c, '[email protected]');
UTL_SMTP.OPEN_DATA(c);
send_header('From', '"Sender" <[email protected]>');
send_header('To', '"Recipient" <[email protected]>');
send_header('Subject', 'Hello');
UTL_SMTP.WRITE_DATA(c, UTL_TCP.CRLF || 'Hello, world!');
UTL_SMTP.CLOSE_DATA(c);
UTL_SMTP.QUIT(c);
EXCEPTION
WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
BEGIN
UTL_SMTP.QUIT(c);
EXCEPTION
WHEN UTL_SMTP.TRANSIENT_ERROR OR UTL_SMTP.PERMANENT_ERROR THEN
NULL; -- When the SMTP server is down or unavailable, we don't have
-- a connection to the server. The QUIT call will raise an
-- exception that we can ignore.
END;
raise_application_error(-20000,
'Failed to send mail due to the following error: ' || sqlerrm);
END;
Also review the next link for get more information about the UTL_SMTP packege.
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_smtp.htm#sthref15587
Regards. -
How to send a mail in workflow keeping 1 receiver in CC and the other in TO
Hi,
Can anybody tell me how to send a mail in workflow keeping 1 receiver in CC and the other in TO.
I need to send a mail to an employee keeping his/her manager in CC through workflow.
Regards,
LavanyaHi Lavanya,
I dont think its possible using Send mail step type.
But it can be done by using the FM SO_NEW_DOCUMENT_SEND_API1. Just create a method and Call this FM accordingly.
Thanks,
Viji. -
How to send a mail in pdf format file in sbwp??
how to send a mail in pdf format file in sbwp?? and how to read the content of the mail?
Refer the following link for Sample Program:
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm -
How to send a mail by ckicking the button using java
hi,
how to send a mail by clicking the button (like payroll silp in that contain one button if we click that it autometically go through the mail as a attachment) pls frd to me my gmail is [email protected]Hi,
It seems we are doing the homework for you; to make you start with something; look at the sample code below and try to understand it first then put the right values
to send an email with an attachement.
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.util.Date;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class Main {
* @param args
public static void main(String[] args) {
// Create the frame
String title = "Frame Title";
JFrame frame = new JFrame(title);
// Create a component to add to the frame
JComponent comp = new JTextField();
Action action = new AbstractAction("Button Label") {
// This method is called when the button is pressed
public void actionPerformed(ActionEvent evt) {
System.out.println("sending email with attachment");
sendEmail();
// Create the button
JButton button = new JButton(action);
// Add the component to the frame's content pane;
// by default, the content pane has a border layout
frame.getContentPane().add(comp, BorderLayout.SOUTH);
frame.getContentPane().add(button, BorderLayout.NORTH);
// Show the frame
int width = 300;
int height = 300;
frame.setSize(width, height);
frame.setVisible(true);
protected static void sendEmail() {
String from = "me@localhost";
String to = "me@localhost";
String subject = "Important Message";
String bodyText = "This is a important message with attachment";
String filename = "c:\\tmp\\message.pdf";
Properties properties = new Properties();
properties.put("mail.stmp.host", "localhost");
properties.put("mail.smtp.port", "25");
Session session = Session.getDefaultInstance(properties, null);
try {
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.setRecipient(Message.RecipientType.TO, new InternetAddress(
to));
message.setSubject(subject);
message.setSentDate(new Date());
// Set the email message text.
MimeBodyPart messagePart = new MimeBodyPart();
messagePart.setText(bodyText);
// Set the email attachment file
MimeBodyPart attachmentPart = new MimeBodyPart();
FileDataSource fileDataSource = new FileDataSource(filename) {
@Override
public String getContentType() {
return "application/octet-stream";
attachmentPart.setDataHandler(new DataHandler(fileDataSource));
attachmentPart.setFileName(filename);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messagePart);
multipart.addBodyPart(attachmentPart);
message.setContent(multipart);
Transport.send(message);
} catch (MessagingException e) {
e.printStackTrace();
}The sample above is not ideal so you need to go through it and start to ask me some questions if you have
Let me know if you miss something
Regards,
Alan Mehio
London,UK -
How to send HTML mail with images multipart/related message
Hi,
Could any body tell me how to send HTML mail with images in "multipart/related" message,if any body can give the code ,it would be helpful.
ThanksHi,
Could any body tell me how to send HTML mail with
ith images in "multipart/related" message,if any body
can give the code ,it would be helpful.
ThanksHi!
Refer to
http://developer.java.sun.com/developer/onlineTraining/JavaMail/index.html
I've found it very helpful.
Look at the last part for a code showing how to send HTML mail!
Regards -
I developed a system where users can login and check for updated information and documents. But the changes are made once or twice in a year. I want to send email after changing the documents. I stored email addresses in the DB. Now the question is how to send e-mails to concerned users without using external software (Outlook, etc.). [Considering same subject and message for all e-mails.]
Go to Java Mail forum:
http://forum.java.sun.com/forum.jsp?forum=43 -
How to send a mail to the user when a job gets canceled?
Hi experts,
I need to send a mail when a job gets canceled to the user.I know the FM for sending mail and i can find if a job is canceled from tbtco,but i want to know how to send the mail from the same program ,once it got canceled ?
thanks in advance,
helpful answers will be awarded with points
regards,
ashwinHi Ashwin
Use the below peace of code:
REPORT ZBCJOBMONITOR .
TABLES: SOMLREC90,
TBTCO.
DATA: MAILDATA LIKE SODOCCHGI1.
DATA: MAILTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILREC LIKE SOMLREC90 OCCURS 0 WITH HEADER LINE.
DATA: I_TBTCO LIKE TBTCO OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001 .
SELECT-OPTIONS: S_JOB FOR TBTCO-JOBNAME.
SELECT-OPTIONS: S_JOBC FOR TBTCO-JOBClass.
SELECT-OPTIONS: S_REC FOR SOMLREC90-RECEIVER.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
CLEAR: MAILDATA, MAILTXT, MAILREC, I_TBTCO.
REFRESH: MAILTXT, MAILREC, I_TBTCO.
PERFORM GET_ABENDED_JOBS.
PERFORM BUILD_RECEIVERS.
LOOP AT I_TBTCO.
PERFORM BUILD_TEXT_MESSAGE.
PERFORM SEND_MAIL_NODIALOG..
ENDLOOP.
Form BUILD_TEXT_MESSAGE
FORM GET_ABENDED_JOBS.
SELECT * FROM TBTCO
INTO CORRESPONDING FIELDS OF TABLE I_TBTCO
WHERE JOBNAME IN S_JOB
AND STATUS = 'A'
AND JOBCLASS IN S_JOBC
AND SDLSTRTDT = SY-DATUM.
ENDFORM.
Form BUILD_TEXT_MESSAGE
FORM BUILD_TEXT_MESSAGE.
DATA: DATE(10) TYPE C.
DATA: TIME(10) TYPE C.
MAILDATA-OBJ_NAME = 'MONITOR'.
MAILDATA-OBJ_DESCR = 'Batch Job Monitor'.
MAILDATA-OBJ_LANGU = SY-LANGU.
CONCATENATE 'Job Name:' I_TBTCO-JOBNAME
INTO MAILTXT-LINE SEPARATED BY SPACE.
APPEND MAILTXT.
PERFORM FORMAT_DATE USING I_TBTCO-SDLSTRTDT
DATE.
CONCATENATE I_TBTCO-SDLSTRTTM+0(2) ':'
I_TBTCO-SDLSTRTTM+2(2) ':'
I_TBTCO-SDLSTRTTM+4(2)
INTO TIME.
CONCATENATE 'Start Date/Time:' DATE TIME
INTO MAILTXT-LINE SEPARATED BY SPACE.
APPEND MAILTXT.
CONCATENATE 'Job Class:' I_TBTCO-JOBCLASS
INTO MAILTXT-LINE SEPARATED BY SPACE.
APPEND MAILTXT.
MAILTXT-LINE = 'Job has terminated abnormally'.
APPEND MAILTXT.
ENDFORM.
Form BUILD_RECEIVERS
FORM BUILD_RECEIVERS.
LOOP AT S_REC.
CLEAR MAILREC.
MAILREC-RECEIVER = S_REC-LOW.
MAILREC-REC_TYPE = 'U'.
APPEND MAILREC.
ENDLOOP.
ENDFORM.
Form SEND_MAIL_NODIALOG
FORM SEND_MAIL_NODIALOG.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = MAILDATA
DOCUMENT_TYPE = 'RAW'
PUT_IN_OUTBOX = 'X'
TABLES
OBJECT_HEADER = MAILTXT
OBJECT_CONTENT = MAILTXT
RECEIVERS = MAILREC
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
Form FORMAT_DATE
FORM FORMAT_DATE USING IN
OUT.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = IN
IMPORTING
DATE_EXTERNAL = OUT
EXCEPTIONS
DATE_INTERNAL_IS_INVALID = 1
OTHERS = 2.
ENDFORM.
Regards,
Sree -
How to send a mail to a person from after completeing bdc .
Hi Xperts,
Please send me a options how to send a mail to a person after completing a bdc or from any report program.
mailed can be a sapuser or other service provider(ex:yahoo,gmail.any thing)
Please Any one i want it now .
Thank You.FUNCTION RS_SEND_MAIL_FOR_SPOO* Email ITAB structure
DATA: BEGIN OF EMAIL_ITAB OCCURS 10.
INCLUDE STRUCTURE SOLI.
DATA: END OF EMAIL_ITAB.
DATA: T_EMAIL LIKE SOOS1-RECEXTNAM. "EMail distribution list
CONSTANTS: C_EMAIL_DISTRIBUTION LIKE SOOS1-RECEXTNAM VALUE
[email protected],[email protected].
Initialization
REFRESH EMAIL_ITAB.
Populate data
EMAIL_ITAB-LINE = Email body text 1.
APPEND EMAIL_ITAB.
EMAIL_ITAB-LINE = Email body text 2.
APPEND EMAIL_ITAB.
T_EMAIL = C_EMAIL_DISTRIBUTION.
--- EMAIL FUNCTION ---------------------------------------------------
REQUIRMENTS:
1) The user running the program needs a valid email address in their
address portion of tx SU01 under external comms -> SMTP -> internet
address.
2) A job called SAP_EMAIL is running with the following parameters:
Program: RSCONN01 Variant: INT User: XXX
This program moves mail from the outbox to the mail server using
RFC destination: SAP_INTERNET_GATEWAY_SERVER
INTERFACE:
1) APPLICATION: Anything
2) EMAILTITLE: EMail subject
3) RECEXTNAM: EMail distribution lists separated by commas
4) TEXTTAB: Internal table for lines of the email message
EXCEPTIONS:
Send OK = 0 otherwise there was a problem with the send.
CALL FUNCTION 'Z_SEND_EMAIL_ITAB'
EXPORTING
APPLICATION = 'EMAIL'
EMAILTITLE = 'Email Subject'
RECEXTNAM = T_EMAIL
TABLES
TEXTTAB = EMAIL_ITAB
EXCEPTIONS
OTHERS = 1.
Function Z_SEND_EMAIL_ITAB
""Local interface:
*" IMPORTING
*" VALUE(APPLICATION) LIKE SOOD1-OBJNAM
*" VALUE(EMAILTITLE) LIKE SOOD1-OBJDES
*" VALUE(RECEXTNAM) LIKE SOOS1-RECEXTNAM
*" TABLES
*" TEXTTAB STRUCTURE SOLI
*- local data declaration
DATA: OHD LIKE SOOD1,
OID LIKE SOODK,
TO_ALL LIKE SONV-FLAG,
OKEY LIKE SWOTOBJID-OBJKEY.
DATA: BEGIN OF RECEIVERS OCCURS 0.
INCLUDE STRUCTURE SOOS1.
DATA: END OF RECEIVERS.
*- fill odh
CLEAR OHD.
OHD-OBJLA = SY-LANGU.
OHD-OBJNAM = APPLICATION.
OHD-OBJDES = EMAILTITLE.
OHD-OBJPRI = 3.
OHD-OBJSNS = 'F'.
OHD-OWNNAM = SY-UNAME.
*- send Email
CONDENSE RECEXTNAM NO-GAPS.
CHECK RECEXTNAM <> SPACE AND RECEXTNAM CS '@'.
*- for every individual recipient send an Email
(see OSS message 0120050409/0000362105/1999)
WHILE RECEXTNAM CS ','.
PERFORM INIT_REC TABLES RECEIVERS.
READ TABLE RECEIVERS INDEX 1.
RECEIVERS-RECEXTNAM = RECEXTNAM+0(SY-FDPOS).
ADD 1 TO SY-FDPOS.
SHIFT RECEXTNAM LEFT BY SY-FDPOS PLACES.
MODIFY RECEIVERS INDEX 1.
PERFORM SO_OBJECT_SEND_REC
TABLES TEXTTAB RECEIVERS
USING OHD.
ENDWHILE.
*- check last recipient in recipient list
IF RECEXTNAM <> SPACE.
PERFORM INIT_REC TABLES RECEIVERS.
READ TABLE RECEIVERS INDEX 1.
RECEIVERS-RECEXTNAM = RECEXTNAM.
MODIFY RECEIVERS INDEX 1.
PERFORM SO_OBJECT_SEND_REC
TABLES TEXTTAB RECEIVERS
USING OHD.
ENDIF.
ENDFUNCTION.
FORM SO_OBJECT_SEND_REC *
FORM SO_OBJECT_SEND_REC
TABLES OBJCONT STRUCTURE SOLI
RECEIVERS STRUCTURE SOOS1
USING OBJECT_HD STRUCTURE SOOD1.
DATA: OID LIKE SOODK,
TO_ALL LIKE SONV-FLAG,
OKEY LIKE SWOTOBJID-OBJKEY.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
EXTERN_ADDRESS = 'X'
OBJECT_HD_CHANGE = OBJECT_HD
OBJECT_TYPE = 'RAW'
OUTBOX_FLAG = 'X'
SENDER = SY-UNAME
IMPORTING
OBJECT_ID_NEW = OID
SENT_TO_ALL = TO_ALL
OFFICE_OBJECT_KEY = OKEY
TABLES
OBJCONT = OBJCONT
RECEIVERS = RECEIVERS
EXCEPTIONS
ACTIVE_USER_NOT_EXIST = 1
COMMUNICATION_FAILURE = 2
COMPONENT_NOT_AVAILABLE = 3
FOLDER_NOT_EXIST = 4
FOLDER_NO_AUTHORIZATION = 5
FORWARDER_NOT_EXIST = 6
NOTE_NOT_EXIST = 7
OBJECT_NOT_EXIST = 8
OBJECT_NOT_SENT = 9
OBJECT_NO_AUTHORIZATION = 10
OBJECT_TYPE_NOT_EXIST = 11
OPERATION_NO_AUTHORIZATION = 12
OWNER_NOT_EXIST = 13
PARAMETER_ERROR = 14
SUBSTITUTE_NOT_ACTIVE = 15
SUBSTITUTE_NOT_DEFINED = 16
SYSTEM_FAILURE = 17
TOO_MUCH_RECEIVERS = 18
USER_NOT_EXIST = 19
X_ERROR = 20
OTHERS = 21.
IF SY-SUBRC <> 0.
RAISE OTHERS.
ENDIF.
ENDFORM.
FORM INIT_REC *
FORM INIT_REC TABLES RECEIVERS STRUCTURE SOOS1.
CLEAR RECEIVERS.
REFRESH RECEIVERS.
MOVE SY-DATUM TO RECEIVERS-RCDAT .
MOVE SY-UZEIT TO RECEIVERS-RCTIM.
MOVE '1' TO RECEIVERS-SNDPRI.
MOVE 'X' TO RECEIVERS-SNDEX.
MOVE 'U-' TO RECEIVERS-RECNAM.
MOVE 'U' TO RECEIVERS-RECESC.
MOVE 'INT' TO RECEIVERS-SNDART.
MOVE '5' TO RECEIVERS-SORTCLASS.
APPEND RECEIVERS.
ENDFORM.
2.
Maybe you are looking for
-
How to ChangePlantfor each item of Sales order using User Exit SAVE_DOCUMEN
Hi All, I have to change plant for Each line item of sales order using (MV45AFZZ) (USEREXIT_SAVE_DOCUMENT) based on first Schedule line. if Confirmed Quantity is Less than Ordered Quantity. based on first Schedule line. it has to select other Plant a
-
I connect the iPhone to itunes. that works. Everything shows up fine, but I can't drag and drop music from the 'music' section of iTunes 12 on my new mbp or my iMac. I used to be able to. Also, when I slide to delete songs on the iPhone, they still a
-
I can't seem to remove / unload the external swf files e.g when the carousel.swf (portfolio) is displayed and I press the about button the about content is overlapping the carousel (portfolio) . How can I remove / unload an external swf file from the
-
Hrdatabase is not up and running
hi, in my laptop hrdatabase is not running?pointbase is listening but it is showing level 0....please rectify this
-
Hi, If I create a table with a lob and an inserted lob is greater then 4000 bytes how does it get stored in the tablespace. I know it gets stored out-of-the-row, but how much space does it use in a local managed tablespace. For example I got a LMS of