Mail Chokes on attachment
I'm getting attachments rejected by my mail system suddenly. It appears the updated pages documents are too complex or large to go as smtp attachments. Anyone understand what's happening?
Ken Wheeler,
<Email Edited By Host>
The error message contains this, which I've followed but can't find anything that tells me how to git rid of the problem.
The server response was: This message was blocked because its content presents a potentialsecurity issue. Please visit http://support.google.com/mail/bin/answer.py?answer=6590 to review our message content and attachment contentguidelines. gg10sm131021080pbc.46 - gsmtp
Does this give anyone a clue about how to proceed?
Thanks,
Ken Wheeler
Similar Messages
-
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. -
Problem with MacMail on MacBook Air
3 days ago I failed to send a mail with a large (32MB) attachment - and it is no longer in my outbox, draft mails or sent file.
BUT a copy of this same mail now appears every about 15 seconds in my "recovered messages" folder
I noticed when I received a system error saying I had a disk almost full issue - there were over 580 copies of the mail with 32MB attachment in the "recovered messages file"
I deleted them all, and deleted the Trash
BUT the message still keeps re-appearing every 15 seconds or so. So I keep deleting them.
Since then I have not been able to receive mail (altho' I am able to send) and Mail is VERY slow
I am running MAC OS X 10.6.8
I am running Mail version 4.6 (1085)Also here's the log before it happened. As you can see there is no activity from 9:48 to 10:00 am when the sound occurred.
23/02/2014 9:48:12.792 am ntpd[52]: FREQ state ignoring -0.145411 s
23/02/2014 9:48:15.258 am WindowServer[96]: _CGXHWCaptureWindowList: No capable active display found.
23/02/2014 9:48:20.000 am kernel[0]: AppleCamIn::systemWakeCall - messageType = 0xE0000280
23/02/2014 9:48:20.000 am kernel[0]: ARPT: 61.319378: AirPort_Brcm43xx::powerChange: System Sleep
23/02/2014 9:48:20.000 am kernel[0]: ARPT: 61.319390: wl0: powerChange: *** BONJOUR/MDNS OFFLOADS ARE NOT RUNNING.
23/02/2014 9:48:20.000 am kernel[0]: AppleCamIn::systemWakeCall - messageType = 0xE0000340
23/02/2014 10:00:04.000 am bootlog[0]: BOOT_TIME 1393167604 0
23/02/2014 10:00:06.000 am syslogd[17]: Configuration Notice:
ASL Module "com.apple.appstore" claims selected messages.
Those messages may not appear in standard system log files or in the ASL database.
23/02/2014 10:00:06.000 am syslogd[17]: Configuration Notice:
ASL Module "com.apple.authd" sharing output destination "/var/log/system.log" with ASL Module "com.apple.asl".
Output parameters from ASL Module "com.apple.asl" override any specified in ASL Module "com.apple.authd". -
When I want to attach a file to an e-mail I'm sending from my iCloud account it makes the file show up in the body of the e-mail instead of attaching it as a separate file the receiver can open. How can I change this?
It should be an attachment. Your Mac just displays a preview of certain attachments (such as .pdfs) in the body of the message. A PC, for example, will see it as an attached file rather than a preview.
You can save the attachment on your Mac by Control-clicking on it and selecting Save Attachment. -
Why can't I open a Adobe PDF file sent to me by e-mail as an attachment?
Why can't I open a Adobe PDF file sent to me by e-mail as an attachment?
I don't know. What exactly happens? (Exactly - including all error messages in full please) What is your computer (e.g. Windows 7), browser, and email program?
-
Error while sending a mail with pdf attachment
Hai
I am sending mail with an attachment of PDF document. While sending I am getting
javax.activation.UnsupportedDataTypeException: application/pdf
This is my code
public static void setByteArrayAsAttachment(Message msg, byte[] attach)
throws MessagingException {
MimeBodyPart p1 = new MimeBodyPart();
ByteArrayDataSource byteStr = new ByteArrayDataSource(attach,"application/pdf");
p1.setContent(byteStr,"application/pdf");
Multipart mp = new MimeMultipart();
mp.addBodyPart(p1);
msg.setContent(mp);
Can one one help me on this...
Thanks
Jithesh PMChange
p1.setContent(byteStr,"application/pdf");
to
p1.setDataHandler(new DataHandler(byteStr)); -
Problem in excel format while sending mail with excel attachment.
Hi Gurus ,
I am sending a email with Excel attachment using FM SO_DOCUMENT_SEND_API1 or SO_NEW_DOCUMENT_ATT_SEND_API1.
I am able to send a mail with excel attachment with a piece of code which I got from SDN itself.
But the problem is when I am trying to open the attachment, <b>A pop up comes which says that it is not in recognizable format. Would you like to open it?
and several other lines of caution.</b>
When i choose to open it, i get the correct data in one excel sheet. Certain vertical lines of the excel sheet is missing. <b>But no data is missing. </b>
I am attaching the code below. Can any one please tell me where is the problem in this code ?
Thanx in advance
types: begin of t_mara,
matnr type mara-matnr,
matkl type mara-matkl,
mtart type mara-mtart,
meins type mara-meins,
end of t_mara.
data: gt_mara type table of t_mara,
wa_mara like line of gt_mara,
it_packing_list type table of SOPCKLSTI1,
wa_packing_list like line of it_packing_list,
it_receivers type table of SOMLRECI1,
wa_receivers like line of it_receivers,
it_mailbody type table of SOLISTI1,
wa_mailbody like line of it_mailbody,
it_attachment type table of SOLISTI1,
wa_attachment like line of it_attachment.
data: la_doc type SODOCCHGI1.
constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
* get material
select matnr matkl mtart meins
into table gt_mara
from mara
up to 25 rows.
* Populate the subject/generic message attributes
la_doc-obj_langu = sy-langu.
la_doc-obj_descr = 'Material Details' . "Mail Header
la_doc-sensitivty = 'F'.
la_doc-doc_size = 1.
* Add the recipients email address
CLEAR wa_receivers.
REFRESH it_receivers.
wa_receivers-receiver = 'PCSDEVL'.
wa_receivers-rec_type = 'U'.
wa_receivers-com_type = 'INT'.
wa_receivers-notif_del = 'X'.
wa_receivers-notif_ndel = 'X'.
APPEND wa_receivers to it_receivers.
* Mail Body
CLEAR wa_mailbody.
REFRESH it_mailbody.
wa_mailbody-line = 'Please find the attachment'.
APPEND wa_mailbody to it_mailbody.
* Mail attachmwnt
CLEAR wa_attachment.
REFRESH it_attachment.
CONCATENATE 'MATNR' 'MATKL' 'MTART' 'MEINS'
INTO wa_attachment SEPARATED BY con_tab.
CONCATENATE con_cret wa_attachment INTO wa_attachment.
APPEND wa_attachment to it_attachment.
LOOP AT gt_mara INTO wa_mara.
CONCATENATE wa_mara-matnr wa_mara-matkl
wa_mara-mtart wa_mara-meins
INTO wa_attachment SEPARATED BY con_tab.
CONCATENATE con_cret wa_attachment INTO wa_attachment.
APPEND wa_attachment to it_attachment.
ENDLOOP.
* Describe the body of the message
CLEAR wa_packing_list.
REFRESH it_packing_list.
wa_packing_list-transf_bin = space.
wa_packing_list-head_start = 1.
wa_packing_list-head_num = 0.
wa_packing_list-body_start = 1.
wa_packing_list-body_num = 1.
wa_packing_list-doc_type = 'RAW'.
APPEND wa_packing_list to it_packing_list.
* Create attachment notification
wa_packing_list-transf_bin = 'X'.
wa_packing_list-head_start = 1.
wa_packing_list-head_num = 1.
wa_packing_list-body_start = 1.
DESCRIBE TABLE it_attachment LINES wa_packing_list-body_num.
wa_packing_list-doc_type = 'XLS'. " To word attachment change this as 'DOC'
wa_packing_list-obj_descr = ' '.
concatenate wa_packing_list-doc_type 'file' into wa_packing_list-OBJ_DESCR
separated by space.
wa_packing_list-doc_size = wa_packing_list-body_num * 255.
APPEND wa_packing_list to it_packing_list.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = la_doc
PUT_IN_OUTBOX = 'X'
* SENDER_ADDRESS = SY-UNAME
* SENDER_ADDRESS_TYPE = 'B'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
* SENDER_ID =
tables
packing_list = it_packing_list
* OBJECT_HEADER =
CONTENTS_BIN = it_attachment
CONTENTS_TXT = it_mailbody
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
receivers = it_receivers
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.REPORT Zex5 LINE-SIZE 255 LINE-COUNT 255 .
class CL_ABAP_CHAR_UTILITIES definition load. "-->
TABLES : vbap.
SELECT-OPTIONS: s_vbeln FOR vbap-vbeln.
DATA : BEGIN OF itab OCCURS 1,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
matnr LIKE vbap-matnr,
END OF itab.
parameters : p_email like somlreci1-receiver
DATA: tlines type i.
DATA: itmessage LIKE solisti1 OCCURS 1 WITH HEADER LINE. "Ok
DATA: itattach LIKE solisti1 OCCURS 2 WITH HEADER LINE. "Ok
DATA: itpacklist LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
DATA: itreclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
data: itattachment like solisti1 OCCURS 2 WITH HEADER LINE.
start-of-selection.
SELECT vbeln posnr matnr
FROM vbap
INTO TABLE itab
WHERE vbeln IN s_vbeln.
**Make the internal table data to be compatible in excel format .
PERFORM BUILD_XLS_FORMAT.
**Populate message of body text.
clear itmessage.
refresh itmessage.
itmessage = 'Please find attached Excel file'.
append itmessage.
PERFORM send_mail_as_xls_attachment tables itmessage
itattach
using p_email 'Excel Attachment' 'TXT' " 'XLS'
using p_email 'TEXT Attachment' 'TXT' " 'XLS'
'TestFileName'
'SalesOrders' .
*& Form BUILD_XLS_FORMAT
text
--> p1 text
<-- p2 text
form BUILD_XLS_FORMAT.
previosuly we were using for unicode ..now replaced
**Declare constants for the spacing .
*Constants : con1 type x value '0D',
con2 type x value '09'.
Constants : con1 type c
value CL_ABAP_CHAR_UTILITIES=>CR_LF,
con2 type c
value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
**For the Header descriptions.
Concatenate 'SalesORdNo'
'Item'
'Materialno' into itattach separated by con2.
Concatenate con1 itattach into itattach.
Append itattach.
**Now align the items in the itab as above .
Loop at Itab.
concatenate itab-vbeln
itab-posnr
itab-matnr into itattach separated by con2.
concatenate con1 itattach into itattach .
Append itattach.
endloop.
endform. " BUILD_XLS_FORMAT
*& Form send_mail_as_xls_attachment
text
-->P_ITMESSAGE text
-->P_ITATTACH text
-->P_P_EMAIL text
-->P_0116 text
-->P_0117 text
-->P_0118 text
-->P_0119 text
form send_mail_as_xls_attachment tables p_itmessage
p_itattach
using p_email
p_mtitle
p_format
p_filename
p_attdescription.
Data : xdocdata like sodocchgi1,
xcnt type i.
*Fill the document data.
xdocdata-doc_size = 1.
*Populate the subject/generic message attributes.
xdocdata-obj_name = 'SAPRPT'.
xdocdata-obj_langu = sy-langu.
xdocdata-obj_descr = p_mtitle.
*Fill the document data and fetch size of attachment.
clear xdocdata.
read table itattach index xcnt.
xdocdata-doc_size = ( xcnt - 1 ) * 255 + strlen( itattach ).
xdocdata-doc_size = ( xcnt - 1 ) * 255.
xdocdata-obj_name = 'SAPRPT'.
xdocdata-obj_langu = sy-langu.
xdocdata-obj_descr = p_mtitle.
clear itattachment. refresh itattachment.
itattachment[] = p_itattach[].
*Describe the body of the message.
clear itpacklist. refresh itpacklist.
itpacklist-transf_bin = 'X'.
itpacklist-head_start = '1'.
itpacklist-head_num = '0'.
itpacklist-body_start = '1'.
describe table itattachment lines itpacklist-body_num .
itpacklist-doc_type = 'TXT'.
itpacklist-doc_type = 'XLS'.
append itpacklist.
*Create attachment notification.
itpacklist-transf_bin = 'X'.
itpacklist-head_start = '1'.
itpacklist-head_num = '1'.
itpacklist-body_start = '1'.
describe table itattachment lines itpacklist-body_num .
itpacklist-doc_type = p_format.
itpacklist-obj_name = p_filename.
itpacklist-obj_descr = p_attdescription.
itpacklist-doc_size = itpacklist-body_num * 255 .
append itpacklist.
*FIll the receivers list.
Clear itreclist. refresh itreclist.
itreclist-receiver = p_email.
itreclist-rec_type = 'U'.
itreclist-com_type = 'INT'.
itreclist-notif_del = 'X'.
itreclist-notif_ndel = 'X'.
*itreclist-notif_read = 'X'.
append itreclist.
*CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = xdocdata
PUT_IN_OUTBOX = 'X'
commit_work = 'X'
SENDER_ADDRESS = SY-UNAME
tables
packing_list = itpacklist
CONTENTS_BIN = itattachment
CONTENTS_TXT = itmessage
receivers = itreclist
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.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = xdocdata
PUT_IN_OUTBOX = 'X'
TABLES
packing_list = itpacklist
CONTENTS_BIN = itattachment
CONTENTS_TXT = itmessage
receivers = itreclist
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. " send_mail_as_xls_attachment
Just execute the above code and let me know.
What is the sap version u r using .
Vijay -
Error in Sending Mail with excel attachment
Hi All,
While sending a mail with excel attachment it is getting successfully send but when i am opening the excel it gives a popup saying "The file is not in recognizable format", and when i click OK the data is getting displayed.
So anybody has any idea of how to remove the popup??
I am using SO_NEW_DOCUMENT_ATT_SEND_API1 FM for sending the mail.
Can anybody help me regarding this.
Thanks
SalishHi,
I was facing the issue when I did not populate the parameters packing_list, object_header,contents_bin, contents_txt of the FM
SO_NEW_DOCUMENT_ATT_SEND_API1 properly.
Also the possible cause could be the configuration in SCOT, not very sure about this. Check with the BASIS guy.
Regards,
Sagar -
Send Mail with Multiple Attachment
How to send mail with multiple attachment. The documents are in a table column BLOB. Read and attach in to mail directly.
We dont want save the documents into hard disk and attach to mail. Please Help
If you have java procedure or Pl/Sql Procedure. I think pl/sql cant. So please mail me code to [email protected] mail id. Thank you.
Thanks in advance
SelvamHi all
Thanks for your reply, already tried this methods, Its not working for my requirements. Because my attachment is can be any type like pdf,doc,txt,xls,jpg, .
And also the Utl_mail is very slow. Its using RAW type.
I can use the javamail package to solve this problem, this javamail package needs to download into server from there you can attach thus documents into mail. But I want fetch the documents and ate the same time I want attach to a mail. Like yahoo attach or msn attachment.
Thank you,
Selvam -
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 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 -
Sending UTL_SMTP mail with Multiple attachment
Hi,
My Environment ----> Oracle Database 11g r1 on Windows 2003 Server (64Bit).
The below script i used for sending mail with single attachment now i am trying to send mail with multiple attachment please tell me how to achieve this
DECLARE
/*LOB operation related varriables */
v_src_loc BFILE := BFILENAME('DATA_PUMP_DIR', 'EXPORT.LOG');
l_buffer RAW(54);
l_amount BINARY_INTEGER := 54;
l_pos INTEGER := 1;
l_blob BLOB := EMPTY_BLOB;
l_blob_len INTEGER;
v_amount INTEGER;
/*UTL_SMTP related varriavles. */
v_connection_handle UTL_SMTP.CONNECTION;
v_from_email_address VARCHAR2(30) := '[email protected]';
v_to_email_address VARCHAR2(30) := '[email protected]';
v_smtp_host VARCHAR2(30) := 'MAIL.EXPORT.COM'; --My mail server, replace it with yours.
v_subject VARCHAR2(30) := 'MULTIPLE Attachment Test';
l_message VARCHAR2(200) := 'TEST Mail for Multiple Attachment';
/* This send_header procedure is written in the documentation */
PROCEDURE send_header(pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS
BEGIN
UTL_SMTP.WRITE_DATA(v_connection_handle,
pi_name || ': ' || pi_header || UTL_TCP.CRLF);
END;
BEGIN
/*Preparing the LOB from file for attachment. */
DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY); --Read the file
DBMS_LOB.CREATETEMPORARY(l_blob, TRUE); --Create temporary LOB to store the file.
v_amount := DBMS_LOB.GETLENGTH(v_src_loc); --Amount to store.
DBMS_LOB.LOADFROMFILE(l_blob, v_src_loc, v_amount); -- Loading from file into temporary LOB
l_blob_len := DBMS_LOB.getlength(l_blob);
/*UTL_SMTP related coding. */
v_connection_handle := UTL_SMTP.OPEN_CONNECTION(host => v_smtp_host);
UTL_SMTP.HELO(v_connection_handle, v_smtp_host);
UTL_SMTP.MAIL(v_connection_handle, v_from_email_address);
UTL_SMTP.RCPT(v_connection_handle, v_to_email_address);
UTL_SMTP.OPEN_DATA(v_connection_handle);
send_header('From', '"Sender"');
send_header('To', '"Recipient"');
send_header('Subject', v_subject);
--MIME header.
UTL_SMTP.WRITE_DATA(v_connection_handle,
'MIME-Version: 1.0' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Type: multipart/mixed; ' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
' boundary= "' || 'SAUBHIK.SECBOUND' || '"' ||
UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
-- Mail Body
UTL_SMTP.WRITE_DATA(v_connection_handle,
'--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Type: text/plain;' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
' charset=US-ASCII' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, l_message || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
-- Mail Attachment
UTL_SMTP.WRITE_DATA(v_connection_handle,
'--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Type: application/octet-stream' ||
UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Disposition: attachment; ' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
' filename="' || 'export.log' || '"' || --My filename
UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
/* Writing the BLOL in chunks */
WHILE l_pos < l_blob_len LOOP
DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
UTL_SMTP.write_raw_data(v_connection_handle,
UTL_ENCODE.BASE64_ENCODE(l_buffer));
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
l_buffer := NULL;
l_pos := l_pos + l_amount;
END LOOP;
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
-- Close Email
UTL_SMTP.WRITE_DATA(v_connection_handle,
'--' || 'SAUBHIK.SECBOUND' || '--' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
UTL_TCP.CRLF || '.' || UTL_TCP.CRLF);
UTL_SMTP.CLOSE_DATA(v_connection_handle);
UTL_SMTP.QUIT(v_connection_handle);
DBMS_LOB.FREETEMPORARY(l_blob);
DBMS_LOB.FILECLOSE(v_src_loc);
EXCEPTION
WHEN OTHERS THEN
UTL_SMTP.QUIT(v_connection_handle);
DBMS_LOB.FREETEMPORARY(l_blob);
DBMS_LOB.FILECLOSE(v_src_loc);
RAISE;
END;
Thank you
ShanHi Saubhik
Thanks for your reply, below script i used to send mail with multiple attachments, plsql code is executing without any error messages and i am also able to receive mail with the multiple attachment.
i used your code which u posted in OTN then i changed little bit as per my need, output is ok.but the problem is if i want to add one more file then i have to add more varaiables in the code. i want to make the code which i can add more attachments without adding more varaiables i don't know the way to do this. can u please give me some hints.
Thanks for your help
Shan
Script Used:
DECLARE
/*LOB operation related varriables01 */
v_src_loc BFILE := BFILENAME('DATA_PUMP_DIR', 'EXPORT.LOG');
l_buffer RAW(54);
l_amount BINARY_INTEGER := 54;
l_pos INTEGER := 1;
l_blob BLOB := EMPTY_BLOB;
l_blob_len INTEGER;
v_amount INTEGER;
/*LOB operation related varriables02 */
v_src_loc2 BFILE := BFILENAME('DATA_PUMP_DIR', 'EXPORT1.LOG');
l_buffer2 RAW(54);
l_amount2 BINARY_INTEGER := 54;
l_pos2 INTEGER := 1;
l_blob2 BLOB := EMPTY_BLOB;
l_blob_len2 INTEGER;
v_amount2 INTEGER;
/*UTL_SMTP related varriavles. */
v_connection_handle UTL_SMTP.CONNECTION;
v_from_email_address VARCHAR2(30) := '[email protected]';
v_to_email_address VARCHAR2(30) := '[email protected]';
v_smtp_host VARCHAR2(30) := 'MAIL.EXPORT.COM'; --My mail server, replace it with yours.
v_subject VARCHAR2(30) := 'MULTIPLE Attachment Test';
l_message VARCHAR2(200) := 'TEST Mail for Multiple Attachment';
/* This send_header procedure is written in the documentation */
PROCEDURE send_header(pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS
BEGIN
UTL_SMTP.WRITE_DATA(v_connection_handle,
pi_name || ': ' || pi_header || UTL_TCP.CRLF);
END;
BEGIN
/*Preparing the LOB from file for attachment01. */
DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY); --Read the file
DBMS_LOB.CREATETEMPORARY(l_blob, TRUE); --Create temporary LOB to store the file.
v_amount := DBMS_LOB.GETLENGTH(v_src_loc); --Amount to store.
DBMS_LOB.LOADFROMFILE(l_blob, v_src_loc, v_amount); -- Loading from file into temporary LOB
l_blob_len := DBMS_LOB.getlength(l_blob);
/*Preparing the LOB from file for attachment02. */
DBMS_LOB.OPEN(v_src_loc2, DBMS_LOB.LOB_READONLY); --Read the file
DBMS_LOB.CREATETEMPORARY(l_blob2, TRUE); --Create temporary LOB to store the file.
v_amount2 := DBMS_LOB.GETLENGTH(v_src_loc2); --Amount to store.
DBMS_LOB.LOADFROMFILE(l_blob2, v_src_loc2, v_amount2); -- Loading from file into temporary LOB
l_blob_len2 := DBMS_LOB.getlength(l_blob2);
/*UTL_SMTP related coding. */
v_connection_handle := UTL_SMTP.OPEN_CONNECTION(host => v_smtp_host);
UTL_SMTP.HELO(v_connection_handle, v_smtp_host);
UTL_SMTP.MAIL(v_connection_handle, v_from_email_address);
UTL_SMTP.RCPT(v_connection_handle, v_to_email_address);
UTL_SMTP.OPEN_DATA(v_connection_handle);
send_header('From', '"Sender"');
send_header('To', '"Recipient"');
send_header('Subject', v_subject);
--MIME header.
UTL_SMTP.WRITE_DATA(v_connection_handle,
'MIME-Version: 1.0' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Type: multipart/mixed; ' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
' boundary= "' || 'SAUBHIK.SECBOUND' || '"' ||
UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
-- Mail Body
UTL_SMTP.WRITE_DATA(v_connection_handle,
'--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Type: text/plain;' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
' charset=US-ASCII' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, l_message || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
-- Mail Attachment01
UTL_SMTP.WRITE_DATA(v_connection_handle,
'--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Type: application/octet-stream' ||
UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Disposition: attachment; ' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
' filename="' || 'export.log' || '"' || --My filename
UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
/* Writing the BLOL in chunks */
WHILE l_pos < l_blob_len LOOP
DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
UTL_SMTP.write_raw_data(v_connection_handle,
UTL_ENCODE.BASE64_ENCODE(l_buffer));
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
l_buffer := NULL;
l_pos := l_pos + l_amount;
END LOOP;
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
-- Mail Attachment02
UTL_SMTP.WRITE_DATA(v_connection_handle,
'--' || 'SAUBHIK.SECBOUND' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Type: application/octet-stream' ||
UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Disposition: attachment; ' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
' filename="' || 'export1.log' || '"' || --My filename
UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
/* Writing the BLOL in chunks */
WHILE l_pos2 < l_blob_len2 LOOP
DBMS_LOB.READ(l_blob2, l_amount2, l_pos2, l_buffer2);
UTL_SMTP.write_raw_data(v_connection_handle,
UTL_ENCODE.BASE64_ENCODE(l_buffer2));
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
l_buffer2 := NULL;
l_pos2 := l_pos2 + l_amount2;
END LOOP;
UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
-- Close Email
UTL_SMTP.WRITE_DATA(v_connection_handle,
'--' || 'SAUBHIK.SECBOUND' || '--' || UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(v_connection_handle,
UTL_TCP.CRLF || '.' || UTL_TCP.CRLF);
UTL_SMTP.CLOSE_DATA(v_connection_handle);
UTL_SMTP.QUIT(v_connection_handle);
DBMS_LOB.FREETEMPORARY(l_blob);
DBMS_LOB.FILECLOSE(v_src_loc);
DBMS_LOB.FREETEMPORARY(l_blob2);
DBMS_LOB.FILECLOSE(v_src_loc2);
EXCEPTION
WHEN OTHERS THEN
UTL_SMTP.QUIT(v_connection_handle);
DBMS_LOB.FREETEMPORARY(l_blob);
DBMS_LOB.FILECLOSE(v_src_loc);
DBMS_LOB.FREETEMPORARY(l_blob2);
DBMS_LOB.FILECLOSE(v_src_loc2);
RAISE;
END;
PL/SQL procedure successfully completed.
Edited by: SHAN2009 on May 11, 2011 1:05 PM -
Receiver Mail Adapter with Attachment and Mailpackage
I have set up a scenario
filesystem: filexxx.xml filexxx.pdf
xml= mailpackage format to get the receiver mailaddress
pdf=the file i want to send as a attchment.
I am using the RenemAttachment module i found on SDN.
in SXMB_MONI it looks ok, the attachment name is filexxx.pdf application/pdf
But when i look at the mail send it shows as attachments
Untitled.txt and Untitled.pdf
Any id's
I only want to send the mail woth one attachment, the original pdf as a attchment.
tnxIssue should be solved with SP17.
I solved by putting the attacgement into the content part of the message.
like.
<?xml version="1.0" encoding="ISO8859-1"?>
<ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
<Subject>Greenery:TESTTEST</Subject>
<From>customerservicedesk@xxxxxxx</From>
<To>Peter.schults@xx</To>
<Content_Type>application/pdf; name=TEST.pdf</Content_Type>
<Content_Description>PDF FAKTUUR</Content_Description>
<Content_Disposition>attachment; filename=TEST.pdf</Content_Disposition>
</ns1:Mail> -
How to send a mail with PDF attachment
Hello
Good Day!
We have a requirement to send the mail with pdf attachment. Pdf file will be remain same for all mails and it will be placed at server. We are on R12.4 and below is the database information :
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
Thanks a ton for your anticipated help!
Thanks
GauravThe word URGENT is considered as rude in this forum.. Nobody here is getting paid for the ansers they are giving..
Just have a look at These threads.Those will help you. -
I want to have Mail list Received e-mails chronologically without attaching new e-mails received to older e-mails from the same recipient/with the same title. Is there a Preferences setting or a toggle to set this?
View menu.
Uncheck "Organize by Conversation."
Regards,
Barry
BTW: Mail is part of the bundled "System software" and is discussed in the community for your version of OS X:
Mac OS X v10.7 Lion
The link will take you there.
Edit: I see someone has requested a transfer, and this conversation is now in the correct space.
Barry
Maybe you are looking for
-
How can I copy an email attachment from my iphone to my windows pc without using itunes
Is there a way to transfer or copy a .zip file attachment in my mail on my iphone to my windows 7 PC without using iTunes?
-
Hello experts, i want to send raw material to a subcontractor for external process. my raw material is Steel Rods and i am sending it for some micro blasting process or some finishing process. i want to send the plastic crates with the rods. (capacit
-
I can't shut down iphoto, it continues to say "photos are being imported to the library"
I tried to download about 70 photos from my camera and it kept saying 1 photo remaining for over 30 minutes so I removed my camera and just figured there was something wrong with the download. Now, when I try to shut down iphoto it continues to say
-
Why do temporary internet files show up as a tab?
Why are temporary internet files showing up as a tab in FF ver 8? I have the private browsing option on.
-
I formatted my mmc last day so that all data is lost, but in the theme option it still had shortcut of the removed theme ,it also happen for tone option, i still can see the shortcut of the tone that have been gone.,. Please how to fix dis?