Send Mail with Long URL - Link getting split w/CR/LF in Email
I am using a send mail step and including a long URL so that the user can
access an Iview directly from the URL Link. The URL which is about 250 characters long is getting split across multiple lines in the MS Outlook Email therby losing the link (only the first line underlined). I am loading the container element contianing the link from a standard text and appending the necessary IView parmater to the end. I tried enclosing my URL within an href but that did not work wither. My current workaround is to code my own method
which sends the email but would rather using the standard Send Mail Step.
Any ideas will be greatly appreciated.
Hi Bob
There are some limitations - you could note 363986
Regards
Morten Nielsen
Similar Messages
-
Send mail with business object link
Hi,
can anyone please tell me, how can i send a mail with an business object as an attachement. when i clik on attachment, it should execute the method of business object which will display the document.
it will be a great help,if any one can send the code.
Thanks,
naresh.Hi,
You need classes CA_SAPUSER_BCS and CL_CAM_ADDRESS_BCS .
CLASS ca_sapuser_bcs DEFINITION LOAD.
CLASS cl_cam_address_bcs DEFINITION LOAD.
You require the following local variables:
DATA: send_request TYPE REF TO cl_bcs.
DATA: document TYPE REF TO cl_document_bcs.
DATA: sender TYPE REF TO cl_sapuser_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
DATA: exception_info TYPE REF TO if_os_exception_info,
bcs_exception type ref to cx_bcs.
DATA: num_rows type i.
DATA: textlength type SO_OBJ_LEN.
First create a mail request:
send_request = cl_bcs=>create_persistent( ).
Create the mail sender:
Get sender object
sender = cl_sapuser_bcs=>create( sy-uname ).
Add sender
CALL METHOD send_request->set_sender
EXPORTING i_sender = sender.
You can define your mail address in this Web Application Server in the user maintenance.
The mail can be sent to one or more addresses:
Create recipient
data: c_address TYPE ADR6-SMTP_ADDR.
move mail_address to c_address.
recipient = cl_cam_address_bcs=>create_internet_address(
c_address ).
Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = ' '
i_copy = ' '
i_blind_copy = ' '.
You receive the mail address as a string and you have to convert in into the required data type.
The mail is sent to one address only without any additional attributes.
You can now send the mail and write everything to the database.
Send document
CALL METHOD send_request->send( ).
COMMIT WORK.
You still have not taken any precautions against error situations.
You can take care of this by embedding the following code in a TRY CATCH block:
try.
... Now the code comes after the creation of send_request up to the COMMIT WORK:
catch cx_bcs into bcs_exception.
if messages is not initial.
messages->add_message( condition = 'mail'
message =
'Error occurred while sending the mail' )."#EC NOTEXT
endif.
exit
endtry.
Reward if it is helpful.
Regards,
Rajesh -
Send mail with attachment from the uploaded file
hi,
From a form thread i got the following code to send mail with attachment with the file uploaded from the file upload ui element.
public void onActionLoadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionLoadFile(ServerEvent)
WDWebResourceType FileType = null;
String FileName = new String();
//get attribute info for context attribute 'FileUpload'
IWDAttributeInfo attributeInfo =
wdContext.getNodeInfo().getAttribute(
IPrivateEmailView.IContextElement.FILE_UPLOAD);
//get modifiable binary type from the attribute info,requires type cast.
IWDModifiableBinaryType binaryType =
(IWDModifiableBinaryType) attributeInfo.getModifiableSimpleType();
IPrivateEmailView.IContextElement element =
wdContext.currentContextElement();
//if a file in the 'FileResource' attribute exists
if (element.getFileUpload() != null) {
try {
String mimeType = binaryType.getMimeType().toString();
byte[] file = element.getFileUpload();
//get the size of the uploaded file
element.setFileSize(this.getFileSize(file));
//get the extension of the uploaded file
element.setFileExtension(binaryType.getMimeType().getFileExtension());
//NOTE: context attribute 'FileName' must not be set
//because the FileUpload-UI-element property 'fileName'
//is bound to it. Consequently the fileName is automatically
//written to the context after file upload.
//report success message
wdComponentAPI.getMessageManager().reportMessage(
IMessageEmailComp.SF_UPLOAD,
new Object[] { binaryType.getFileName()},
false);
FileType = binaryType.getMimeType();
FileName = binaryType.getFileName();
} catch (Exception e) {
throw new WDRuntimeException(e);
//if no file in the 'FileResource' attribute exists
else {
//report error message
IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
msgMgr.reportContextAttributeMessage(
element,
attributeInfo,
IMessageEmailComp.NO_FILE,
new Object[] { "" },
true);
//clear the FileResource context value attribute
//element.setFileUpload(null);
String URL;
URL = this.CreateAndGetPathFileUpload(
wdContext.currentContextElement().getFileUpload(),
FileName);
// if (URL.length() == 1){
// //ERRORE
wdContext.currentContextElement().setPATHFileUploaded(URL);
//@@end
public boolean send( java.lang.String subj, java.lang.String mess, java.lang.String dest, java.lang.String attach, java.lang.String FileName )
//@@begin send()
InitialContext ctx = null;
Address[] address = null;
Message msg = null;
Session sess = null;
MimeBodyPart bodyPart = null;
Multipart mp = null;
// "141.29.193.71" == milvl2ja.icn.siemens.it (SMTP di Siemens)
try {
Properties props = new Properties();
props.put("domain","true");
ctx = new InitialContext(props);
sess = (Session) ctx.lookup("java:comp/env/mail/MailSession");
msg = new MimeMessage(sess);
IWDClientUser utente = WDClientUser.getCurrentUser();
String senderEmail = utente.getSAPUser().getEmail();
InternetAddress addressFrom = new InternetAddress(senderEmail);
msg.setFrom(addressFrom);
String EmailDEST = dest;
InternetAddress addressTo = new InternetAddress(EmailDEST);
msg.setRecipient(Message.RecipientType.TO, addressTo);
msg.setSubject(subj);
// if ((mess != null) && (mess.length()>0)) {
// msg.setContent(mess, "text/plain");
// } else {
// msg.setContent("", "text/plain");
//Gestione ATTACHMENT...
String attachedFileName = new String(wdContext.currentContextElement().getFileName());
boolean hasAttachment = (attachedFileName != null) && (attachedFileName.length() > 0);
boolean isMultiPart = (mess != null) && (mess.length() > 1);
//adding an attachment makes the message multipart
if (isMultiPart || hasAttachment) {
mp = new MimeMultipart();
// add text parts
if (mess != null) {
for (int i = 0; i < mess.length(); i++) {
bodyPart = new MimeBodyPart();
bodyPart.setContent(mess,"text/plain");
mp.addBodyPart(bodyPart);
//attach the file to the message if needed
if (hasAttachment) { // avoid the case with no text parts
bodyPart = new MimeBodyPart();
bodyPart.setContent("Allegato incluso nel messaggio.","text/plain");
mp.addBodyPart(bodyPart);
// the part with the file
FileDataSource fds = new FileDataSource(attach);
MimeBodyPart attachmentBodyPart = new MimeBodyPart();
attachmentBodyPart.setDataHandler(new DataHandler(fds));
//URL URLattachedFileName = new URL(attach);
//attachmentBodyPart.setDataHandler(new DataHandler(URLattachedFileName));
attachmentBodyPart.setFileName(FileName);
mp.addBodyPart(attachmentBodyPart);
msg.setContent(mp);
} else {
if ((mess != null) && (mess.length() > 0)) {
msg.setContent(mess, "text/plain");
} else {
msg.setContent("", "text/plain");
//fine ATTACHMENT
msg.setSentDate(new GregorianCalendar().getTime());
msg.saveChanges();
address = msg.getAllRecipients();
Transport.send(msg, address);
} catch (Exception e) {
e.printStackTrace();
return false;
return true;
//@@end
When i used the same code in my application i am gett ing error in many places..
1)FileDataSource fds = new FileDataSource(<b>attach</b>);
attach cannot be resolved
2)attachmentBodyPart.setFileName(<b>FileName</b>);
fliename cannot be resolved
3)byte[] file = element.getFileUpload();
type mismatch cannot convert sting to byte[]
4)element.setFileSize(this.getFileSize(file));
method getFileSize() is undefined
5)element.setFileExtension(binaryType.getMimeType().getFileExtension());
method getFilExtension() is undefined
6)URL = this.CreateAndGetPathFileUpload(wdContext.currentContextElement().getFileUpload(),FileName);
method CreateAndGetPathFileUpload() is undefined.
7)wdContext.currentContextElement().setPATHFileUploaded(URL);
from the above error i can understand that only i have got the part of the code.
Please send me the complete coding.
some method definitions are missing....
Please help me to send the mail with attachment from the file uploaded from the file upload ui element.
Thanks in advance,
shami.hi,
I got this from the following link
Re: Attaching an excel file
plz help me ...
I am using 2004s with nwds 7.0.06.
also tell me what should be the type of the context variable FileUpload
Thanks in advance,
shami. -
Sending mail with multiple attachment
hi.
i want to send mail with multiple attachment.
i m succeed in sending multiple attachment but the second pdf is not open.
its given error like "This file is damaged and could not be open.
pls check my code. and
give the solution....
point should be assured...........
hope all u r understand my problem..
& tell me where is i m missing something.
REPORT YSDPASALE1_MAIL LINE-SIZE 110.
data : year_month(6) type c.
data : from_date like sy-datum,to_date like sy-datum.
INITIALIZATION.
year_month = sy-datum+0(6).
CONCATENATE year_month '01' into from_date.
to_date = sy-datum.
ranges : temp for mkpf-budat.
temp-low = from_date.
temp-high = to_date.
append temp to temp.
DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,
jobname like TBTCJOB-JOBNAME,
L_RELEASE(1) TYPE c.
CONSTANTS : l_c_device(4) VALUE 'LOCL'.
DATA : t type i value 0.
DATA : p_email1 like somlreci1-receiver,
p_sender LIKE somlreci1-receiver.
Data Declaration
DATA: gd_recsize TYPE i,gd_recsize1 TYPE i.
Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att1 LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att2 LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_desc1 TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des,
gd_mtitle LIKE sodocchgi1-obj_descr.
Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
DATA: BEGIN OF mailstr OCCURS 0,
p_email like somlreci1-receiver,
END OF mailstr.
DATA: mailtab like STANDARD TABLE OF mailstr WITH HEADER LINE.
DATA: ypp18tab like STANDARD TABLE OF mailstr WITH HEADER LINE,
ymis008tab like STANDARD TABLE OF mailstr WITH HEADER LINE,
ysd15tab like STANDARD TABLE OF mailstr WITH HEADER LINE,
ymis10tab like STANDARD TABLE OF mailstr WITH HEADER LINE.
SUBMIT YSDPASALE1 with bdt in temp
to sap-spool
with line-size = '255'
with KEEP_IN_SPOOL = 'X'
with IMMEDIATELY = ' '
WITHOUT SPOOL DYNPRO
AND RETURN
NEW-PAGE PRINT ON
DESTINATION l_c_device
IMMEDIATELY ' '
KEEP IN SPOOL 'X'
NEW LIST IDENTIFICATION 'X'
NO DIALOG.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
PERFORM convert_spool_to_pdf.
select yemail as p_email into CORRESPONDING FIELDS OF TABLE ymis008tab
from ymail
where ytcode = 'YMIS008'.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool & mail sending',
'request to be created.'.
ENDIF.
wait up to 3 seconds.
submit YSD_MONTHLY_SALES
USING SELECTION-SET 'MAIL'
to sap-spool
with KEEP_IN_SPOOL = 'X'
with IMMEDIATELY = ' ' "SPACE
WITHOUT SPOOL DYNPRO
AND RETURN
NEW-PAGE PRINT ON
DESTINATION l_c_device
IMMEDIATELY ' '
KEEP IN SPOOL 'X'
NEW LIST IDENTIFICATION 'X'
NO DIALOG.
new-page print off.
IF sy-batch EQ 'X'.
gd_attachment_desc1 = 'YMIS10'.
gd_mtitle = 'Monthly Sales Report'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
PERFORM convert_spool_to_pdf1.
loop at it_mess_att.
move it_mess_att1 to it_mess_att.
APPEND it_mess_att.
endloop.
APPEND LINES OF it_mess_att1 to it_mess_att.
free it_mess_att1.
it_mess_att[] = it_mess_att1[].
insert LINES OF it_mess_att1 into it_mess_att.
APPEND LINES OF it_mess_att2 to it_mess_att .
insert LINES OF it_mess_att1 into it_mess_att.
insert LINES OF it_mess_att2 into it_mess_att.
loop at ymis008tab into mailstr.
p_email1 = mailstr-p_email.
p_email1 = '[email protected]'.
PERFORM process_email.
endloop.
clear mailstr.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ELSE.
SKIP.
ENDIF.
FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
FORM get_job_details *
FORM get_job_details.
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
FORM convert_spool_to_pdf1.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att1 = gd_buffer.
APPEND it_mess_att1.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
DESCRIBE TABLE it_mess_att1 LINES gd_recsize1.
CHECK gd_recsize > 0 or gd_recsize1 > 0.
PERFORM send_email." USING p_email1.
perform send_email using p_email2.
ENDFORM.
FORM send_email *
--> p_email *
FORM send_email." USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = gd_attachment_desc1 .
gd_attachment_desc = 'YPP18 - Daily Highlights'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Dear Sir,'.
APPEND it_mess_bod.
it_mess_bod = ' '.
APPEND it_mess_bod.
it_mess_bod = ' '.
APPEND it_mess_bod.
it_mess_bod = 'kindly find the attached document'.
APPEND it_mess_bod.
it_mess_bod = ' '.
APPEND it_mess_bod.
it_mess_bod = 'Do not reply on this mail, It is generated from SAP'.
APPEND it_mess_bod.
it_mess_bod = ' '.
APPEND it_mess_bod.
it_mess_bod = ' '.
APPEND it_mess_bod.
it_mess_bod = 'Regards,'.
APPEND it_mess_bod.
it_mess_bod = 'Arpit Shah'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
it_mess_att1
using "p_email
gd_mtitle
'Testing mail generated from SAP'
'Daily Highlights Abstract Report - YPP18'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables it_message
it_attach
it_attach1
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.
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,w_doc_data1 like sodocchgi1.
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_data1-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[] = it_attach[].
For 2nd Attachments
* Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach1 INDEX w_cnt.
w_doc_data-doc_size = w_doc_data1-doc_size +
( w_cnt - 1 ) * 255 + STRLEN( it_attach1 ).
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.
APPEND LINES OF it_attach1 to t_attachment.
t_attachment[] = it_attach1[].
APPEND LINES OF it_attach1 to t_attachment.
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 = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
DESCRIBE TABLE it_mess_att LINES t_packing_list-body_num.
DESCRIBE TABLE it_attach LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = 'YMIS008'."ld_attdescription.
t_packing_list-obj_name = 'YMIS008'."ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
clear t_packing_list.
for 2 attachments
data : a type i,b type i.
a = t_packing_list-body_num.
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = a + 1. "1
DESCRIBE TABLE it_mess_att1 LINES t_packing_list-body_num.
DESCRIBE TABLE it_attach1 LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = 'YMIS10'."ld_attdescription.
t_packing_list-obj_name = 'YMIS10'."ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
a = t_packing_list-body_num.
clear 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 = a + 1.
t_packing_list-body_num = t_packing_list-body_num + 1.
DESCRIBE TABLE it_mess_att1 LINES t_packing_list-body_num.
t_packing_list-body_num = a + t_packing_list-body_num .
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = 'YMIS10'."ld_attdescription.
t_packing_list-obj_name = 'YMIS10'."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.
loop at ymis008tab into mailstr.
t_receivers-receiver = mailstr-p_email. "ld_email.
t_receivers-receiver = p_email1.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'. "X "Read Acknoledgement
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
endloop.
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.
Rgds.
ArpitHi Arpit,
Take a look at the documentation of FM 'SO_DOCUMENT_SEND_API1' for parameter PACKING_LIST. I think you should set t_packing_list-head_num to a different value than 0 for the second attachment.
Regards,
John. -
Sending Mail with an Attachment
Hi
I'm trying to send mail with a PDF attached. I've been set up on exchange server 2007... Sending mail without an attachment works fine.
Was wondering if anyone knows if this is a known issue or if I'm simply doing something wrong. The attachment has sent fine using Outlook web access... So it's not a problem with our connection.
Cheers
LucyDitto to the comments on configuring EWS to deal with larger attachments. The instructions to do this are, unfortunately, very confusing as some configuration items are in MB and some are in KB and some are in bytes!
I worked with our sys admins to get this running, I knew things were better when I could send large attachments with Entourage Web Services Edition. I am still having occasional problems with large attachments not being sendable with Mail.app. I am hoping that 10.6.1 might tweak something to fix this?
The link we used for information is here:
http://ministry-it.blogspot.com/2009/08/entourage-ews-attachment-limits.html
While you are at it, you may want to have them check attachment limits for Outlook Web Access (OWA) if you find yourself using that and get bitten by the same 5 MB limit issue. Note that OWA and EWS have separate settings and are changed in different ways!
http://technet.microsoft.com/en-us/library/aa996835.aspx
Good luck
-- Alex -
Can´t send mail with 3g
I have problem with my outgoing server.
I have 3 outgoing servers:
Primary: mail1.comhem.se
Secundary servers: mailout.telia.com
smtprelay1.telia.com
It works well sending mails with Wifi but as soon it goes to 3g it doesn´t work any longer, and these messages pops up saying that address is not valid or connection timeout.
But as soon as it get back to Wifi, swoosch and away it goes!
What can be wrong? Have I missed something in the setup?
Receiving mail are no problem with 3g.When I used mobile-smtp.roadrunner.com it failed to send. It put the message in the Outbox and said the sender address [email protected] was rejected by the server.
I think that's because my roadrunner email is on the cinci.rr.com server and not the roadrunner.com server
I had it set up:
mobile-smtp.roadrunner.com
SSL off
Authentication: Password checked
server port 587 <-----note it wouldn't accept 597 here. The 587 port is there in all mail servers once they verify
In order for my mail to work with AT&T's network, I had to make their server the Primary:
Primary Server: cwmx.com
SSL off
Server Port 25
Authentication" Password checked
I've tried all these below as Secondary servers
smtp-server.cinci.rr.com
SSL off
Authentication: Password checked
server port 587
smtp-server.roadrunner.com
SSL off
Authentication: Password checked
server port 587
mobile-smtp.roadrunner.com
SSL off
Authentication: Password checked
server port 587 -
Sending mail with excel attachment-improper format
Dear experts,
I am sending a mail to outlook with an excel attachment. The mail is sent with attachment and the data, but all in one cell.
I am using SO_NEW_DOCUMENT_ATT_SEND_API1. What parameters do i need to manipulate to have data in different columns of excel? I am using "packing_list" table of FM. But dont know the exact parameters to be passed. Can anyone help with the same please?
Best regards and thanks!
Sumit Nene.Hello Sumit,
I am using same function module to send mail with excel attachment.
Below I am attaching my own code for your reference.
Data which u want to add in excel file is maintain in IT_OBJBIN i.e. document information.
CLEAR :IMESSAGE,IT_OBJBIN,IT_OBJPACK,IT_RECLIST.
REFRESH: IMESSAGE[ ] , IT_OBJBIN[ ] , IT_OBJPACK[ ] , IT_RECLIST[ ].
" populate the text for body of the mail
CLEAR WA_IMESSAGE.
CONCATENATE 'Board : ' P_BOARD ':' 'Please find the excel attached for the list of Material whose routing is created' INTO WA_IMESSAGE-LINE.
APPEND WA_IMESSAGE TO IMESSAGE.
"document information
W_DOC_CHNG-OBJ_NAME = 'Excel'.
IF NOT P_BOARD IS INITIAL.
CONCATENATE 'Board : ' P_BOARD ':' 'List Of Routing Materials' INTO W_DOC_CHNG-OBJ_DESCR.
ELSE.
CONCATENATE 'List Of' ' Routing Materials' INTO W_DOC_CHNG-OBJ_DESCR.
ENDIF.
W_DOC_CHNG-SENSITIVTY = 'F'. " ->Functional object
" displaying material , plant in the excel
CONCATENATE 'BOARD NO : ' P_BOARD INTO WA_OBJBIN.
APPEND WA_OBJBIN TO IT_OBJBIN.
CONCATENATE 'MATERIAL' 'PLANT' 'DESCRIPTION' INTO WA_OBJBIN SEPARATED BY C_TAB.
CONCATENATE C_RET WA_OBJBIN INTO WA_OBJBIN.
APPEND WA_OBJBIN TO IT_OBJBIN.
CLEAR : WA_OBJBIN.
LOOP AT IT_DOWNLOAD INTO WA_DOWNLOAD. "It_orders is the internal table to be transferred to excel
CONCATENATE WA_DOWNLOAD-MATNR WA_DOWNLOAD-WERKS WA_DOWNLOAD-DESC INTO WA_OBJBIN SEPARATED BY C_TAB.
CONCATENATE C_RET WA_OBJBIN INTO WA_OBJBIN.
APPEND WA_OBJBIN TO IT_OBJBIN.
ENDLOOP.
DESCRIBE TABLE IT_OBJBIN LINES V_LINES_BIN. " no of lines for excel data
" pack the data as RAW
CLEAR WA_IT_OBJPACK-TRANSF_BIN. "Obj. to be transported not in binary form
WA_IT_OBJPACK-HEAD_START = 1. "Start line of object header in transport packet
WA_IT_OBJPACK-HEAD_NUM = 0. "Number of lines of an object header in object packet
WA_IT_OBJPACK-BODY_START = 1. "Start line of object contents in an object packet
WA_IT_OBJPACK-BODY_NUM = MESSAGE_LINES. "Number of lines of the mail body
WA_IT_OBJPACK-DOC_TYPE = 'RAW'.
APPEND WA_IT_OBJPACK TO IT_OBJPACK.
" pack the data as excel
WA_IT_OBJPACK-TRANSF_BIN = 'X'.
WA_IT_OBJPACK-HEAD_START = 1.
WA_IT_OBJPACK-HEAD_NUM = 1.
WA_IT_OBJPACK-BODY_START = 1.
WA_IT_OBJPACK-BODY_NUM = V_LINES_BIN. "no of lines of it_orders to give no of unprocessed orders
WA_IT_OBJPACK-DOC_TYPE = 'XLS'. " -> excel fomat
WA_IT_OBJPACK-OBJ_NAME = 'EXCEL ATTACHMENT'.
" attachment name
IF NOT P_BOARD IS INITIAL.
CONCATENATE P_BOARD '.XLS' INTO WA_IT_OBJPACK-OBJ_DESCR.
ELSE.
CONCATENATE 'LIST' '.XLS' INTO WA_IT_OBJPACK-OBJ_DESCR.
ENDIF.
WA_IT_OBJPACK-DOC_SIZE = V_LINES_BIN * 255.
APPEND WA_IT_OBJPACK TO IT_OBJPACK.
" creating email id
DATA: STR1 TYPE STRING,
STR2 TYPE STRING,
STR3 TYPE STRING,
ITAB TYPE TABLE OF STRING.
DATA : WA_I LIKE LINE OF ITAB.
SPLIT P_EMAIL AT ',' INTO: TABLE ITAB.
e-mail receivers.
CLEAR WA_IT_RECLIST.
LOOP AT ITAB INTO WA_I.
WA_IT_RECLIST-RECEIVER = WA_I.
WA_IT_RECLIST-RECEIVER = V_MAILADDR.
WA_IT_RECLIST-EXPRESS = 'X'.
WA_IT_RECLIST-REC_TYPE = 'U'. "-> Internet address
APPEND WA_IT_RECLIST TO IT_RECLIST.
CLEAR WA_IT_RECLIST.
ENDLOOP.
" sending mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
PACKING_LIST = IT_OBJPACK
OBJECT_HEADER =
CONTENTS_BIN = IT_OBJBIN
CONTENTS_TXT = IMESSAGE
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
RECEIVERS = IT_RECLIST
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
COMMIT WORK.
IF SY-SUBRC = 0.
MESSAGE I001 WITH 'Routing is Created for Board' P_BOARD 'and Mail send on e-mail id :' P_EMAIL.
ENDIF. -
Sending mail with multiple attachments
hi.I wrote a code to send mail.but i need to send mail with multiple attachments.here is the code i wrote.what should i do to send the mail with multiple attachments.if i run this code iam able to send mails but not attachments.please help me
<%@ page import="javax.mail.*,javax.mail.internet.*,java.util.Date,java.io.*,java.net.InetAddress,java.sql.*,java.util.Properties,java.net.*,javax.sql.*,javax.activation.*,java.util.*,java.text.*" %>
<%@ page import="java.io.*,java.sql.*,java.net.*,java.util.*,java.text.*" %>
<%
String Attachfiles1="";
String Attachfiles2="";
String Attachfiles3="";
if("Send".equalsIgnoreCase("send"))
try
String subject="",from="",url = null,to="";
String mailhost = "our local host";
Properties props = System.getProperties();
String msg_txt="";
String strStatus="";
// byte[] bin=.....;
//Adds Attechment:
Multipart multipart = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText("Here are my attachments");
multipart.addBodyPart(messageBodyPart);
messageBodyPart = new MimeBodyPart();
//first attachment
DataSource source = new FileDataSource("C:\\img1.jpg");
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName("C:\\Telnor1.jpg");
multipart.addBodyPart(messageBodyPart);
//Second attachment
DataSource source2 = new FileDataSource("C:\\img2.jpg");
messageBodyPart.setDataHandler(new DataHandler(source2));
messageBodyPart.setFileName("C:\\Telnor2.jpg");
multipart.addBodyPart(messageBodyPart);
//etc...
message.setContent(multipart);
Transport.send( message );
String mailer = "MyMailerProgram";
to=request.getParameter("to");
from=request.getParameter("from");
subject=request.getParameter("subject");
msg_txt=request.getParameter("message");
props.put("mail.smtp.host", mailhost);
Session mailsession = Session.getDefaultInstance(props, null);
Message message = new MimeMessage(mailsession);
message.setFrom(new InternetAddress(from));
message.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to, false));
message.setSubject(subject);
message.setHeader("X-Mailer", mailer);
message.setSentDate(new Date());
message.setText(msg_txt);
BodyPart messageBodyPart = new MimeBodyPart();
BodyPart messageBodyPart2 = new MimeBodyPart();
Multipart multipart = new MimeMultipart(); // to add many part to your messge
messageBodyPart = new MimeBodyPart();
javax.activation.DataSource source = new javax.activation.FileDataSource("path of the file");
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName("file_name");
messageBodyPart2.setText("message"); // set the txt message
multipart.addBodyPart(messageBodyPart);
multipart.addBodyPart(messageBodyPart2);
Transport.send(message);
out.println("Message Sent");
catch (Exception e)
e.printStackTrace();
if("Attachfiles".equalsIgnoreCase("attachfiles"))
Attachfiles1=request.getParameter("fieldname1");
Attachfiles2=request.getParameter("fieldname2");
Attachfiles3=request.getParameter("fieldname3");
%>
<html>
<body>
<div class="frame">
<form action="Composemail.jsp" method="post">
<b>SelectPosition:</b> <select name="cars" >
<option value="ABAP">ABAP
<option value="saab">Saab
<option value="fiat">Fiat
<option value="audi">Audi
</select><br><br>
<table border="1" cellpadding="2" cellspacing="2">
<tr><th>Name</th>
<th>EmailId</th>
<th>ContactNumber</th>
<th>Position</th>
</tr>
<tr>
<td>
</td>
</tr>
</table><br>
<b>SelectUser :</b><select name="cars">
<option value="Administrator">Administrator
<option value="saab">Saab
<option value="fiat">Fiat
<option value="audi">Audi
</select>
<br>
<b>To :</b>           <input type="text" name="to" size="72"><br>
<b>From :</b>       <input type="text" name="from" size="72"><br>
<b>Subject :</b>   <input type="text" name="subject" size="72"><br>
<%=Attachfiles1%><br><%=Attachfiles2%><br><%=Attachfiles3%><br><br>
<b>Message:</b><br>
            <textarea rows="10" cols="50" name="message">
</textarea> <br><br>
<b>AttachedFile:</b> <input type="file" name="fieldname1" value="filename" size="50"><br><br>
<b>AttachedFile:</b> <input type="file" name="fieldname2" value="filename" size="50"><br><br>
<b>AttachedFile:</b> <input type="file" name="fieldname3" value="filename" size="50"><br><br>
            <input type="submit" name="attachfiles" value="Attachfiles">
<center>
<input type="submit" name="send" value="Send" >
</center>
</form>
</div>
</body>
</html>Create a separate MimeBodyPart object for each attachment, rather than reusing
the same one over and over. -
Can't send Mail with AOL address-out of ideas
hello,
I can recieve mail just fine. It's only when I try to send it. I've tried changing the outgoing server to smtp.aol.com and 4.78.166.10.
changed the ports from 25 to 587 to 1024.
I appreciate your help. thanks in advance.
-Seth
powermac g4 Mac OS X (10.3.9)My girlfriend and I are RoadRunner customers and RR allows using an SMTP server outside of their network as long as the SMTP server is authenticated.
I set up my girlfriend's AOL account in Tiger Mail (and the only email account she uses) on my old TiBook that I loaned her until she purchases her own Mac and she sends mail with her AOL account with no problems.
The AOL SMTP server settings are as follows:
Outgoing Mail Server: smtp.aol.com
Server Port: 587
Use Secure Sockets Layer (SSL): Off or not selected.
Authentication Type: Password
User Name: Your AOL screen name or the portion of your AOL email address in front of the @ sign only.
Password: The password for this screen name/email account - the same used for checking the account for new mail.
If your settings are the same, try deleting and recreating the account in Mail.
If this doesn't work and it should since it works for my girlfriend, you can select/use the RR SMTP server to send mail with your AOL account which is invisible to all recipients. -
Send mails with csv file as an attachment through oracle(SQL SCripts / Stor
Hello Everybody,
I have recently come across a requirement in which I am supposed to send mails with csv file as an attachment through oracle(SQL SCripts / Stored Procedure) .
The contents of the csv file are to be retreived from the Database as well as the content of the mail and to whom it needs to be sent has also to be picked up from the database.
Can somebody suggest me with a suitable code for the same?
Would be of great help..!!
Thanks & Regards,
- VR
Edited by: user646716 on Dec 18, 2009 10:44 AMread below links
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:255615160805
http://www.orafaq.com/wiki/Send_mail_from_PL/SQL#Send_mail_with_UTL_TCP_-withattachments
How to send csv file as an attachment -
Convert Screen(spool) to PDF file sending mail with attach file
Hi :
I'd like convert spool list to pdf and sending file...
so, I read thread about spool convert to PDF before,
and know how to convert Spool to PDF file and send mail with attach file.
but I have a problem.
my solution as:
step 1. Call function: "CONVERT_ABAPSPOOLJOB_2_PDF"
step 2. Call function: "SO_NEW_DOCUMENT_ATT_SEND_API1"
then, I got a mail with attached PDF file, but the PDF file display limited 255 line.( SO_NEW_DOCUMENT_ATT_SEND_API1 limited)
I want to showing word is wider that 255.
and then I find a manual method as:
After program finished.
Function Menu -> system -> List -> Send
use Prog: "Create Document and Send"
I use this prog sending mail and attached file ,
PDF file do <b>NOT</b> have 255 word limit !
finally. my question is, If I want sending mail as Prog: "Create Document and Send", how to do?
which Function I have to use?...
Please help me, Thanks!Hi,
Check this sample code of sending spool as attachment to an email address..
Parameters.
PARAMETERS: p_email(50) LOWER CASE.
PARAMETERS: p_spool LIKE tsp01-rqident.
Data declarations.
DATA: plist LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: document_data LIKE sodocchgi1.
DATA: so_ali LIKE soli OCCURS 100 WITH HEADER LINE.
DATA: real_type LIKE soodk-objtp.
DATA: sp_lang LIKE tst01-dlang.
DATA: line_size TYPE i VALUE 255.
DATA: v_name LIKE soextreci1-receiver.
DATA rec_tab LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
Get the spool data.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = p_spool
first_line = 1
last_line = 0
desired_type = ' '
IMPORTING
real_type = real_type
sp_lang = sp_lang
TABLES
buffer = so_ali
EXCEPTIONS
no_such_job = 1
job_contains_no_data = 2
selection_empty = 3
no_permission = 4
can_not_access = 5
read_error = 6
type_no_match = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE s208(00) WITH 'Error'.
LEAVE LIST-PROCESSING.
ENDIF.
Prepare the data.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 0.
plist-body_num = 0.
plist-doc_type = 'RAW'.
plist-obj_descr = 'Test ALV'.
APPEND plist.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 1.
DESCRIBE TABLE so_ali LINES plist-body_num.
plist-doc_type = real_type.
Get the size.
READ TABLE so_ali INDEX plist-body_num.
plist-doc_size = ( plist-body_num - 1 ) * line_size
+ STRLEN( so_ali ).
APPEND plist.
Move the receiver address.
MOVE: p_email TO rec_tab-receiver,
'U' TO rec_tab-rec_type.
APPEND rec_tab.
IF NOT sp_lang IS INITIAL.
document_data-obj_langu = sp_lang.
ELSE.
document_data-obj_langu = sy-langu.
ENDIF.
v_name = sy-uname.
Send the email.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = document_data
sender_address = v_name
sender_address_type = 'B'
TABLES
packing_list = plist
contents_bin = so_ali
receivers = rec_tab
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 e208(00) WITH 'Error'.
ENDIF.
COMMIT WORK.
Send the email immediately.
SUBMIT rsconn01
WITH mode = 'INT'
AND RETURN.
Thanks,
Naren -
How to send mail with attachment
Hi,
How to send mail with word document as attachment in oracle pl/sql.
kindly help me .
thank you
regards
P Prakashcreate or replace procedure pdf_mail(
p_sender varchar2, -- sender, example: 'Me <[email protected]>'
p_recipients varchar2, -- recipients, example: 'Someone <[email protected]>'
p_subject varchar2, -- subject
p_text varchar2, -- text
p_filename varchar2, -- name of pdf file
p_blob blob -- pdf file
) is
conn utl_smtp.connection;
i number;
len number;
BEGIN
conn := demo_mail.begin_mail(
sender => p_sender,
recipients => p_recipients,
subject => p_subject,
mime_type => demo_mail.MULTIPART_MIME_TYPE);
demo_mail.begin_attachment(
conn => conn,
mime_type => 'application/pdf',
inline => TRUE,
filename => p_filename,
transfer_enc => 'base64');
-- split the Base64 encoded attachment into multiple lines
i := 1;
len := DBMS_LOB.getLength(p_blob);
WHILE (i < len) LOOP
IF(i + demo_mail.MAX_BASE64_LINE_WIDTH < len)THEN
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.Substr(p_blob, demo_mail.MAX_BASE64_LINE_WIDTH, i)));
ELSE
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.Substr(p_blob, (len - i)+1, i)));
END IF;
UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
i := i + demo_mail.MAX_BASE64_LINE_WIDTH;
END LOOP;
demo_mail.end_attachment(conn => conn);
demo_mail.attach_text(
conn => conn,
data => p_text,
mime_type => 'text/html');
demo_mail.end_mail( conn => conn );
END;
ref:
http://www.plpdf.com/23-1725.html
Edited by: Mahanam on Jan 9, 2011 10:32 PM -
Send mail with picture in mail body
Hi Experts,
How to send mail with picture in mail body area? ( Note : not as an attachment. )
Eg:
......Header image..... <<------ I want to insert image here
Dear user,
You have received a notification.
..... Footer image ..... <<------ I want to insert image here
Note : If user opened mail then user can able to see the image.
Thanks in advance.
Regards,
HarishHi Harish,
Please visit these links:
1. Embed the picture instead of Linking in Mail forms
2. Send HTML mail with image
3. http://sap.ittoolbox.com/groups/technical-functional/sap-dev/html-format-email-528045
May it helps you.
Regards.
Deepak Sharma -
I cannot send mail with my ipod touch using my icloud account
I'm just posting this as I did for all these threads for the same issue:
Ok I think this problem here is Apple... It's a DNS problem. You get this problem depending on what smtp server you are registered on.
I always get the message that "p06-smtp.mail.me.com" failed...
But according to the nslookup command there are only the servers "p01, p02, p03, p04"... no p05 and p06 or p07 and p08 ...
What I did to get it to work (only considered as workaround):
first I tried to add a second SMTP server with the address "smtp.mail.me.com", it seemed that the mail went through... but never arrived... then I configured "p01-smtp.mail.me.com" as second server and it worked!!
What is the problem with this workaround?
When you change the password! As it doesn't accept the Apple Token you must configure your Apple ID credentials manually... however when you change them, you have also to change the manually configured second SMTP server! -
Problem in sending mail with attachment
Hi All,
I am using the function module <b>'SO_NEW_DOCUMENT_ATT_SEND_API1'</b> to send mail with attachment.
the program executes properly and shows a message <b>'Document Sent'</b>. But neither the sent mail appears in <b>'SOST'</b> nor I get it on the specified email id.
Below is my code:
<b>***</b> As attachment I am sending resume whose contents are stored in table 'ZResume' corresponding to personnel no.(pernr) and serial No.(srno).
<b>START OF PROGRAM</b>----
REPORT ZPTEST_SEND_MAIL_ATTATCHMENT.
DATA : w_name TYPE sos04-l_adr_name.
DATA: RESUME TYPE table of XSTRING with header line.
START-OF-SELECTION.
<b>* Data Declaration</b>
DATA:
l_datum(10),
ls_docdata TYPE sodocchgi1,
lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
lt_objhead TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_objbin TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_reclist TYPE TABLE OF somlreci1 WITH HEADER LINE,
lt_listobject TYPE TABLE OF abaplist WITH HEADER LINE,
l_tab_lines TYPE i,
l_att_type LIKE soodk-objtp.
WRITE sy-datum TO l_datum.
SELECT SINGLE RESUME FROM ZRESUME INTO RESUME
WHERE PERNR EQ '00001182'
AND SRNO EQ '1'.
APPEND RESUME.
<b>* Because RESUME may be of size RAW(1000)
and objbin is of size CHAR(255) we make this table copy</b>
CALL FUNCTION 'TABLE_COMPRESS'
TABLES
in = resume
out = lt_objbin
EXCEPTIONS
compress_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
Error in function module &1
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
<b>* Create the message and send the document.
Create Message Body</b>
<b>* Title and Description</b>
ls_docdata-obj_name = 'Resume'.
ls_docdata-obj_descr = 'Resume'.
<b>* Main Text</b>
lt_objtxt = 'Resume of the candidate' .
APPEND lt_objtxt.
<b>* Write Packing List (Main)</b>
DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
READ TABLE lt_objtxt INDEX l_tab_lines.
ls_docdata-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
CLEAR lt_objpack-transf_bin.
lt_objpack-head_start = 1.
lt_objpack-head_num = 0.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = 'RAW'.
APPEND lt_objpack.
<b>* Create Message Attachment
Write Packing List (Attachment)</b>
l_att_type = 'ALI'.
DESCRIBE TABLE lt_objbin LINES l_tab_lines.
READ TABLE lt_objbin INDEX l_tab_lines.
lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objbin ).
lt_objpack-transf_bin = 'X'.
lt_objpack-head_start = 1.
lt_objpack-head_num = 0.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = l_att_type.
lt_objpack-obj_name = 'ATTACHMENT'.
lt_objpack-obj_descr = 'Resume'.
APPEND lt_objpack.
<b>* Create receiver list</b>
lt_reclist-receiver = '[email protected]'.
lt_reclist-rec_type = 'U'.
APPEND lt_reclist.
<b>* Send Message</b>
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = ls_docdata
put_in_outbox = ''
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_bin = lt_objbin
contents_txt = lt_objtxt
receivers = lt_reclist
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.
Document sent
MESSAGE ID 'SO' TYPE 'S' NUMBER '022'.
ELSE.
Document <&> could not be sent
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH ls_docdata-obj_name.
ENDIF.
<b>END OF PROGRAM</b>----
Can anybody tell me where I am making mistake?
Thanks in advance,
PragyaHi Pragya,
Refer the code below. It's working fine and try to match up the things from your program.
REPORT ZSAMPL_001 .
INCLUDE ZINCLUDE_01.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
*file_open_error = 1
*file_read_error = 2
*no_batch = 3
*gui_refuse_filetransfer = 4
*invalid_type = 5
*no_authority = 6
*unknown_error = 7
*bad_data_format = 8
*header_not_allowed = 9
*separator_not_allowed = 10
*header_too_long = 11
*unknown_dp_error = 12
*access_denied = 13
*dp_out_of_memory = 14
*disk_full = 15
*dp_timeout = 16
*OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
***INCLUDE ZINCLUDE_01 .
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
Data
tables crmrfcpar.
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
data v_rfcdest LIKE crmrfcpar-rfcdest.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = reclist
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 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
FORM
FORM ml_saveforbp USING jobname jobcount.
Data
*data : yhead like yhrt_bp_head.
*DATA : ydocdata LIKE yhrt_bp_docdata,
*yobjtxt LIKE yhrt_bp_objtxt OCCURS 0 WITH HEADER LINE,
*yreclist LIKE yhrt_bp_reclist OCCURS 0 WITH HEADER LINE.
*DATA : seqnr TYPE i.
Head
*yhead-jobname = jobname.
*yhead-jobcount = jobcount..
*MODIFY yhrt_bp_head FROM yhead.
Doc Data
*ydocdata-jobname = jobname.
*ydocdata-jobcount = jobcount.
*MOVE-CORRESPONDING docdata TO ydocdata.
*MODIFY yhrt_bp_docdata FROM ydocdata.
Objtxt
*seqnr = 0.
*LOOP AT objtxt.
*seqnr = seqnr + 1.
*yobjtxt-jobname = jobname.
*yobjtxt-jobcount = jobcount.
*yobjtxt-seqnr = seqnr.
*MOVE-CORRESPONDING objtxt TO yobjtxt.
*MODIFY yhrt_bp_objtxt FROM yobjtxt.
*ENDLOOP.
RecList
*seqnr = 0.
*LOOP AT reclist.
*seqnr = seqnr + 1.
*yreclist-jobname = jobname.
*yreclist-jobcount = jobcount.
*yreclist-seqnr = seqnr.
*MOVE-CORRESPONDING reclist TO yreclist.
*MODIFY yhrt_bp_reclist FROM yreclist.
*ENDLOOP.
ENDFORM. "ml_saveforbp
FORM
FORM ml_fetchfrombp USING jobname jobcount.
*CLEAR docdata.
*REFRESH objtxt.
*REFRESH reclist.
*SELECT SINGLE * FROM yhrt_bp_docdata
*INTO corresponding fields of docdata
*WHERE jobname = jobname
*AND jobcount = jobcount.
*SELECT * FROM yhrt_bp_objtxt
*INTO corresponding fields of TABLE objtxt
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
*SELECT * FROM yhrt_bp_reclist
*INTO corresponding fields of TABLE reclist
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
ENDFORM. "ml_fetchfrombp
<b>Please reward points if it helps.</b>
Regards,
Amit Mishra
Maybe you are looking for
-
Using Safari Password Sharing to Autofill Login Info in Apps
At WWDC 2014, developers were told that a new part of the Continuity functionality would be the ability to have Safari keep your login information for an app and autofill it. I think it was called Safari Password Sharing. It's referenced on a number
-
How to open page in same tab in which I have open previous one?
When I open page with command "firefox.exe http://www.mozilla.com/" and then "firefox.exe http://www.google.com/" pages will open in different tabs. Is it possible to open webpage (or html file) outside browser (from command line or shortcut), and th
-
How to get the pid at the oslevel
Hi I have few querys 1)How can i find the pid(oslevel) of a particular session 2)how to know the sid of the session we logged in Thank you
-
[Solved] No Sound Satellite L645D-S4033 Laptop
I have 2 Toshiba Satellites (L645D-S4033) and both have Windows 7 x64 Ultimate installed. Operating system is up to date. Downloaded and installed the drivers from the Toshiba website. There are no question marks or exclamation points in the Devic
-
Invoking procedure from menu module
How can I invoke procedure that is part of Form module from menu module which is attached to it. When I reference it with: procedure_name; I receive: Error 201 Identifier procedure_name must be declared. null