In Mail Body Coming as attachment
Hi All,
I have created one Zfunctionmodule , in that i have used one standard function module SO_NEW_DOCUMENT_SEND_API1.
My problem is Body is coming as an attachment in mail instead of displaying directly.
Plz help me on this..
DATA: ls_mail_doc TYPE sodocchgi1,
lt_header TYPE TABLE OF solisti1,
lt_content TYPE TABLE OF solisti1,
lt_reciever TYPE TABLE OF somlreci1,
ls_header TYPE solisti1,
ls_content TYPE solisti1,
ls_reciever TYPE somlreci1.
ls_reciever-rec_type = 'U'.
ls_reciever-receiver = lv_reciver.
ls_reciever-COM_TYPE = 'INT'.
APPEND ls_reciever TO lt_reciever.
ls_mail_doc-obj_name = 'DRAW'.
ls_mail_doc-obj_descr = 'Invoice Rejection Information'.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = ls_mail_doc
document_type = 'RAW'
commit_work = 'X'
IMPORTING
new_object_id = ev_objid
TABLES
object_header = lt_header
object_content = lt_content
receivers = lt_reciever
Regards,
Siva
you can try with following piece of code
DATA: ls_mail_doc TYPE sodocchgi1,
lt_header TYPE TABLE OF solisti1,
lt_content TYPE TABLE OF solisti1,
lt_reciever TYPE TABLE OF somlreci1,
ls_header TYPE solisti1,
ls_content TYPE solisti1,
ls_reciever TYPE somlreci1,
L_WA_TXT TYPE SOLISTI1,
ev_objid type SOFOLENTI1-OBJECT_ID.
ls_reciever-rec_type = 'U'.
ls_reciever-receiver = 'xyz@xyz..'. " put your email id here
ls_reciever-COM_TYPE = 'INT'.
APPEND ls_reciever TO lt_reciever.
ls_mail_doc-obj_name = 'DRAW'.
ls_mail_doc-obj_descr = 'Invoice Rejection Information'.
L_WA_TXT = 'content of the mail'.
APPEND L_WA_TXT TO lt_content.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = ls_mail_doc
document_type = 'RAW'
commit_work = 'X'
IMPORTING
new_object_id = ev_objid
TABLES
object_header = lt_header
object_content = lt_content
receivers = lt_reciever.
Best Regards
Sanju.Pal
Similar Messages
-
Mail content coming as Attachment too.
Hi -
While we are trying to send mails using SO_DOCUMENT_SEND_API1 ,
the mail content is coming as attachment .
Can you suggest whats worng ?
Thanks,
sandhyaHi,
Try using the sample code below:
*& Report ZBC_ITAB_TO_EXCEL_NEW *
REPORT ZBC_ITAB_TO_EXCEL_NEW .
CLASS: cl_abap_char_utilities DEFINITION LOAD.
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin1 LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin2 LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin_final LIKE solisti1 OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE,
tab_lines TYPE sy-tabix.
DATA: gd_sender_type LIKE soextreci1-adr_typ.
DATA: c_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
c_ret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
DATA: c_dev TYPE sy-sysid.
DATA: BEGIN OF i_data OCCURS 0,
a(20),
b(20),
END OF i_data.
DATA: BEGIN OF st,
f1(2) TYPE c,
f2(2) TYPE n,
END OF st.
DATA: itab1 LIKE TABLE OF st WITH HEADER LINE,
itab2 LIKE TABLE OF st WITH HEADER LINE.
DATA: n TYPE i.
PARAMETER: p_email1 LIKE somlreci1-receiver,
p_sender LIKE somlreci1-receiver.
START-OF-SELECTION.
itab1-f1 = 'AA'. itab1-f2 = '01'. APPEND itab1.
itab1-f1 = 'BB'. itab1-f2 = '02'. APPEND itab1.
itab1-f1 = 'CC'. itab1-f2 = '03'. APPEND itab1.
itab2-f1 = 'ZZ'. itab2-f2 = '26'. APPEND itab2.
itab2-f1 = 'YY'. itab2-f2 = '25'. APPEND itab2.
LOOP AT itab1.
CONCATENATE itab1-f1 itab1-f2 INTO objbin1 separated BY c_tab.
CONCATENATE c_ret objbin1 INTO objbin1.
APPEND objbin1.
ENDLOOP.
LOOP AT itab2.
CONCATENATE itab2-f1 itab2-f2 INTO objbin2 separated BY c_tab.
CONCATENATE c_ret objbin2 INTO objbin2.
APPEND objbin2.
ENDLOOP.
LOOP AT objbin1.
MOVE objbin1-line TO objbin_final-line.
APPEND objbin_final.
ENDLOOP.
LOOP AT objbin2.
MOVE objbin2-line TO objbin_final-line.
APPEND objbin_final.
ENDLOOP.
PERFORM process_email.
c_dev = sy-sysid.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
IF sy-subrc = 0.
WRITE: / 'Email succesfilly delivered'.
ELSE.
WRITE: / 'failure'.
ENDIF.
*& Form process_email
* text
FORM process_email.
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
*Body
docdata-obj_name = 'Mail_Excel_File'.
docdata-obj_descr = 'Excel file attachment'.
objtxt = 'Attached is the sample Excel file'.
APPEND objtxt.
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 = 'RAW'.
APPEND objpack.
*Attachment
n = 1.
DESCRIBE TABLE objbin1 LINES tab_lines.
objpack-doc_size = tab_lines * 255.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = n.
objpack-body_num = tab_lines.
objpack-doc_type = 'XLS'.
docdata-obj_name = 'Excel_File_Attachment1'.
objpack-obj_descr = 'Excel File Attachment1'.
APPEND objpack.
n = n + tab_lines.
DESCRIBE TABLE objbin2 LINES tab_lines.
objpack-doc_size = tab_lines * 255.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = n.
objpack-body_num = tab_lines.
objpack-doc_type = 'XLS'.
docdata-obj_name = 'Excel_File_Attachment2'.
objpack-obj_descr = 'Excel File Attachment2'.
APPEND objpack.
*Create the list of recipients
reclist-receiver = p_email1.
reclist-rec_type = 'U'.
reclist-express = 'X'.
APPEND reclist.
*Send the e-mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
contents_bin = objbin_final
contents_txt = objtxt
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.
COMMIT WORK.
ENDFORM. "process_email
Hope it helps
Regards
Mansi -
E-Mail Body coming as an attachment
Email body is coming as an attachment while sending external mail through SAP
hi Sudhanshu,
Give a little snippet of your code. It will help us to analyze the problem.
Regards,
Shaheen -
Receiver Mail Adapter - Mail body as attachment
Hello friends,
I have scenario = File -> XI -> Mail
The scenario is working but the problem is body of the email is coming as attachment in the mail client.(outlook express)
Is there any way to avoid the body coming as attachment.
Regards
Ramesh PHi Ramesh,
You can use the MessageTransformBean in the receiver mail adapter for this.
Refer this for the parameters which you can use
http://help.sap.com/saphelp_nw04/helpdata/en/57/0b2c4142aef623e10000000a155106/content.htm
Regards,
Chandra -
How to make the main payload be sent as mail body
Hi,
Currently, I want to send out a mail with several attachments by Mail adapter. And <b>the main payload</b> should be sent out as <b>mail body</b> instead of attachment. I know by default, the main payload is also sent as a attachment. So I used the module AF_Modules/MessageTransformBean to make the main payload be sent as mail body instead of attachment. It does work in case there's no attachment to be sent. However if I want to send<b> a mail with several attachments</b> (the attachment is created in my own adapter module using method message.createPayload()), in this case if I use the module AF_Modules/MessageTransformBean, the main payload is sent as mail body , however meanwhile, it is also sent as a attachment. And the attachment I created is also sent as attachment. This is not expected by me. In this case, I wish <b>the main payload</b> is <b>only sent as mail body</b> and <b>other payload</b> created by me as attachment.
Do you have any idea about it?
Thankshi
go through this links:
/people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
/people/michal.krawczyk2/blog/2006/02/23/xi-dynamic-name-in-the-mail-attachment--pseudo-variable-substitution
Thanks -
Hi experts,
I can send all the data of internal table as attachment through mail. But requirement is to send all the data in mail body. No attachment should go with this mail. How to do this?
Regards,
Goutam SahooHi Check this sample program. Clearly mentioned the body of the message .
<pre>REPORT zvenkat_mail_simple.
Mail related declarations
"Variables
DATA :
g_sent_to_all TYPE sonv-flag,
g_tab_lines TYPE i.
"Types
TYPES:
t_document_data TYPE sodocchgi1,
t_packing_list TYPE sopcklsti1,
t_attachment TYPE solisti1,
t_body_msg TYPE solisti1,
t_receivers TYPE somlreci1.
"Workareas
DATA :
w_document_data TYPE t_document_data,
w_packing_list TYPE t_packing_list,
w_attachment TYPE t_attachment,
w_body_msg TYPE t_body_msg,
w_receivers TYPE t_receivers.
"Internal Tables
DATA :
i_document_data TYPE STANDARD TABLE OF t_document_data,
i_packing_list TYPE STANDARD TABLE OF t_packing_list,
i_attachment TYPE STANDARD TABLE OF t_attachment,
i_body_msg TYPE STANDARD TABLE OF t_body_msg,
i_receivers TYPE STANDARD TABLE OF t_receivers.
"start-of-selection.
START-OF-SELECTION.
PERFORM send_mail.
"Form send_mail
" PACKING LIST table requires information about how the data in the
" tables OBJECT_HEADER, CONTENTS_BIN and CONTENTS_TXT are to be
" distributed to the documents and its attachments. The first row is
" for the document, the following rows are each for one attachment.
FORM send_mail .
"Subject of the mail.
w_document_data-obj_name = 'MAIL_TO_HEAD'.
w_document_data-obj_descr = 'Simple mail using SAP ABAP'.
"Body of the mail
PERFORM build_body_of_mail
USING:space,
'Hi,',
'I am fine. How are you? How are you doing ? ',
'This program has been created to send simple mail',
'with Subject,Body with Address of the sender. ',
'Thanks and Regards,',
'Venkat.O,',
'SAP HR Technical Consultant.'.
"Write Packing List (Body)
DESCRIBE TABLE i_body_msg LINES g_tab_lines.
w_packing_list-head_start = 1.
w_packing_list-head_num = 0.
w_packing_list-body_start = 1.
w_packing_list-body_num = g_tab_lines.
w_packing_list-doc_type = 'RAW'.
APPEND w_packing_list TO i_packing_list.
CLEAR w_packing_list.
"Fill the document data and get size of attachment
READ TABLE i_body_msg INTO w_body_msg INDEX g_tab_lines.
w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN( w_body_msg ).
"Receivers List.
w_receivers-rec_type = 'U'. "Internet address
w_receivers-receiver = <give mail id here>.
w_receivers-com_type = 'INT'.
w_receivers-notif_del = 'X'.
w_receivers-notif_ndel = 'X'.
APPEND w_receivers TO i_receivers .
CLEAR:w_receivers.
"Function module to send mail to Recipients
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_document_data
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = g_sent_to_all
TABLES
packing_list = i_packing_list
contents_txt = i_body_msg
receivers = i_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 i303(me) WITH 'Mail has been Successfully Sent.'.
ELSE.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ENDFORM. " send_mail
" Form build_body_of_mail
FORM build_body_of_mail USING l_message.
w_body_msg = l_message.
APPEND w_body_msg TO i_body_msg.
CLEAR w_body_msg.
ENDFORM. " build_body_of_mail</pre>
Thanks
Venkat.O -
SBO mailer working fine but attachment is not coming
Dear All
We have configured the sbo mailer and mails are coming accordingly also, but attachments are missing in mails.
*** SAP Business One Client Log ***
WaitForSingleObject has finished with return value:0
SAP Business One Client return code:0
Distributing results
Unable to extract HTML report output to file C:\Windows\TEMP\Report.html Error code:-2028
Unable to extract PDF report output to file C:\Windows\TEMP\Report.pdf Error code:-2028
Unable to extract XML report output to file C:\Windows\TEMP\Report.xml Error code:-2028
SMTP Server: secure.emailsrvr.com:25
Sender Email: USER<[email protected]>
Sending email to [email protected]
Schedule processed
Please suggest the solution.
Regards
RaviHi Ravi,
Please check Right of Attachment Folder for user.
If user is not having Right to access Attachment Folder then Attachment will not come in mail.
Please provide sufficient right to user for attachment folder then check.
Hope this helps
Regards::::
Atul Chakraborty -
Mail Adapter Use Mail Package, Mail Body and Attachment
Hello
Have some body a idea, how I can configure the mail adapter with use mail package, that I have in the mail a attachment with content from the messages and a mail body with also text from the message.
Thanks for your reply.
Regards Tom
The different Weblog , I have check:
/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]
/people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-addressHi Thomas,
If you are configuring your Mail adapter as reciever then refer
http://help.sap.com/saphelp_nw04/helpdata/en/6b/4493404f673028e10000000a1550b0/content.htm
your sender (say file) should have some message like this
<i>
<ml:Mail xmlns:ml=http://sap.com/xi/XI/Mail/30>
<Subject>Important</Subject>
<From>[email protected]</From>
<To>[email protected]</To>
<X_Mailer>Outlook Express </X_Mailer>
<Content>
This is the content.
</Content>
</ml:Mail></i>
And for Sender Mail Adpater
http://help.sap.com/saphelp_nw04/helpdata/en/23/c093409c663228e10000000a1550b0/content.htm
Hope this will be helpful
Regards
Suraj -
How to put mail body while sending Payment Advice Note by mail
Hi,
I am sending payment advice form through mail using the BTE 2040.
Everything is fine and mail is coming properly but mail does not have any body line. It just contains the PDF as an attachment.
I want to put mail body in that. I have just copied the Script, I have not copied the driver program.
E.g
Hello,
Please find the payment advice note as an attachment.
Kindly advice how to put mail body in that mail, is there any BTE through which we can put the mail body?
Kindly help.
Regards
Sachin YadavHi,
I am sending payment advice form through mail using the BTE 2040.
Everything is fine and mail is coming properly but mail does not have any body line. It just contains the PDF as an attachment.
I want to put mail body in that. I have just copied the Script, I have not copied the driver program.
E.g
Hello,
Please find the payment advice note as an attachment.
Kindly advice how to put mail body in that mail, is there any BTE through which we can put the mail body?
Kindly help.
Regards
Sachin Yadav -
How can you add an image in Mail without being an attachment?
How can you add an image in Mail without being an attachment?
In otherwords I'd like to put my logo in the email not as an attachment but as an image.
Is there a simpel solution to this problem?PBN1 wrote:
How can you add an image in Mail without being an attachment?
You don't.
It's not possible. The e-mail protocol is designed for text; anything else has to go as an attachment.
Different mail clients (such as Mail.app, the mail client bundled with Mac OS X) may have different ways of handling such attachments, but they are still attachments. Each mail client has its own rules and methods, so one may display a picture as if it were in the body of the message, but another client may do something completely different.
A way of faking it is to format your message in HTML (which is a kind of text). The image is hosted on a remote server, not added to the message; instead, you include a link to it in the body of the message, as you would when building a web page. (This is also what the two tips helpfully provided by X423424X do, except that the link to the image is added in the signature, rather than the body of the message.) What exactly happens to it is, again, at the discretion of the mail client. In my case, for instance, displaying images in HTML messages is turned off, and will stay resolutely off. -
Hi All,
I need to know whether it is possible to use multiple font styles in the body of an e-mail sent through a report program.
I am using the FM 'SO_DOCUMENT_REPOSITORY_MANAGER' as I want to send a document from the desktop as an e-mail attachment.
The FM 'SO_DOCUMENT_SEND_API1' does not serve the primary purpose of my requirement. So, it is eliminated.
Please suggest any method to achieve the requirement of using multiple font styles in e-mail body.
Thanks,
DawoodIf you set the document to be a HTML type, then you can use HTML scripting to set
the font.
Create send request
send_request = cl_bcs=>create_persistent( ).
Create html content:
mail_line = '.mail TBODY,{font-family:verdana;font-size:10pt;}'.
append mail_line TO mail_text.
... (your text)
Create document with type 'HTM' and provide your HTML scripting
document = cl_document_bcs=>create_document( i_type = 'HTM'
i_text = mail_text
i_subject = 'Subject' ).
Add document to send request
CALL METHOD send_request->set_document( document ).
Send document
CALL METHOD send_request->send( ). -
How to send mail body using RE_CN_RA_INVOICE interface from RECPA520
Hi ABAP Guru,
I am using a standard interface RE_CN_RA_INVOICE for tcode RECPA520 for generating pdf form and send the corresponding PDF to corresponding address maintained in Business Partner.The problem is mail is sending with attachment but there is no mail body.
Please helpYou have to convert your long string to a table of shorter strings.
There may be other ways, but one possibility is to use a loop to process you string.
while (there is something left)
put the next e.g. 1024 characters in a new row of your table
endwhile
If you need to reconstruct your string from the table, don't use simple concatenation since it will remove blanks at the end of lines. Believe me (from experience) sooner or later this will happen.
Instead you need to either set the subsections of your long string, or insert from the end of your table and keep shifting the contents (probably less efficient) right -
Unable to get source file content as mail body in file to mail scenario
Hi Friends,
I am facing one problem with one of my file to mail scenario in PI(SP9). I have done bypass scenario(without IR only with ID objects). Scenario is working fine, i am getting mail also. But my requirement is i want complete source file content as a mail body (not xml format, text format). I have checked all options, but configured scenario bydefault taking source content as a attachment and mail body is empty. I have tested below options
1. If i choose message protocol as FCC mechanism at source side content at target side i am getting xml format as a attachment( In mail adapter i have selected message protocol as xi payload, and without packate option on mail adapter). If i choose message protocol as xi all, i am getting 2 files as a attachment (one file as a payload content and second file as a source file content in xml format).
2. If i choose message protocol as file at souce side that time i am getting source complete content as a attachment at target side in xml format, but mail attached file content is flat file(.xml extension) format. When i tried to open attachment file that time i am getting error in explorer, but i can see only one row in explorer remaining rows unable to see.
Please share your ideas on this.Hi,
Follow below steps
1. First basis level need to configure setup(SMTP) for mail. After that only mail will go from SAP.
2. Source side depending on requirement take communication channel(idoc, file etc)
3. Receiver side communication channel take mail adapter and configure below setup
3.1 select message protocol XI ALL/ XI PAYLOAD(WITH PACKAGE or WITHOUT PACKAGE)
3.2 if message protocol is XI ALL, the complete content will be sent as a attachment along with payload file
3.3 if message protocol is XI PAYLOAD, the source message, the source message will be sent as attachment. Playload file filter automatically.
3.4 If you use PACKAGE option on mail adaper, this time source strucute need to import from SAP (some standard structure only will be support, without strucutre we can't work). If you choose package option no need to give mail id on communication channel, we need to pass mail id's from source structure.
I hope now clear. -
Hw to write text in mail body in UTL SMTP in oracle
hi all
i m using oracle demo mail package to send csv file as attachment to different users its successfull and i can also able to attach text file to it
but i m unable to write any text in mail body .
e.g.
mail body can be--
hi
This is test mail.
Regds
Sender.
can anyone suggest some way?u can try this code
this code takes the file from database and attach with mail and also send the body with it
it works fine.
CREATE OR REPLACE
procedure pdf_mail(
p_sender varchar2, -- sender, example: 'Me '
p_recipients varchar2, -- recipients, example: 'Someone '
p_subject varchar2, -- subject
p_text long, -- text
p_case_id number,
p_email_log_id number
-- p_filename varchar2, -- name of pdf file
p_blob blob pdf file
) is
conn utl_smtp.connection;
i number;
len number;
p_message_part varchar2(32767);
cursor c1 is
select file_name,document_pic
from clm_case_attachments ca,email_log_detail em
where
case_id = p_case_id
and ca.CASE_ATTACHMENT_ID = em.ATTACHMENT_ID
and em.ACTIVE = 'Y'
and em.EMAIL_LOG_ID = p_email_log_id;
BEGIN
conn := demo_mail.begin_mail(
sender => p_sender,
recipients => p_recipients,
subject => p_subject,
mime_type => demo_mail.MULTIPART_MIME_TYPE);
demo_mail.attach_text(
conn => conn,
data => p_text,
mime_type => 'text/html');
for lp in c1 loop
demo_mail.begin_attachment(
conn => conn,
mime_type => 'application/pdf',
inline => TRUE,
filename => lp.file_name,
transfer_enc => 'base64');
-- split the Base64 encoded attachment into multiple lines
i := 1;
len := DBMS_LOB.getLength(lp.document_pic);
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(lp.document_pic, demo_mail.MAX_BASE64_LINE_WIDTH, i)));
ELSE
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.Substr(lp.document_pic, (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);
end loop;
demo_mail.end_mail( conn => conn );
END;
/ -
Hw to write txt in mail body using UTL mail when sending mail with attachme
hi all
i m using oracle demo mail package to send csv file as attachment to different users its successfull and i can also able to attach text file to it
but i m unable to write any text in mail body .
e.g.
mail body can be--
hi
This is test mail.
Regds
Sender.
can anyone suggest some way?u can try this code
this code takes the file from database and attach with mail and also send the body with it
it works fine.
CREATE OR REPLACE
procedure pdf_mail(
p_sender varchar2, -- sender, example: 'Me '
p_recipients varchar2, -- recipients, example: 'Someone '
p_subject varchar2, -- subject
p_text long, -- text
p_case_id number,
p_email_log_id number
-- p_filename varchar2, -- name of pdf file
p_blob blob pdf file
) is
conn utl_smtp.connection;
i number;
len number;
p_message_part varchar2(32767);
cursor c1 is
select file_name,document_pic
from clm_case_attachments ca,email_log_detail em
where
case_id = p_case_id
and ca.CASE_ATTACHMENT_ID = em.ATTACHMENT_ID
and em.ACTIVE = 'Y'
and em.EMAIL_LOG_ID = p_email_log_id;
BEGIN
conn := demo_mail.begin_mail(
sender => p_sender,
recipients => p_recipients,
subject => p_subject,
mime_type => demo_mail.MULTIPART_MIME_TYPE);
demo_mail.attach_text(
conn => conn,
data => p_text,
mime_type => 'text/html');
for lp in c1 loop
demo_mail.begin_attachment(
conn => conn,
mime_type => 'application/pdf',
inline => TRUE,
filename => lp.file_name,
transfer_enc => 'base64');
-- split the Base64 encoded attachment into multiple lines
i := 1;
len := DBMS_LOB.getLength(lp.document_pic);
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(lp.document_pic, demo_mail.MAX_BASE64_LINE_WIDTH, i)));
ELSE
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.Substr(lp.document_pic, (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);
end loop;
demo_mail.end_mail( conn => conn );
END;
/
Maybe you are looking for
-
Selected variable value is different from the displayed value
Hi all, I have an issue with variable selection in portal. I have a IO - customer which is compounded to source system. So I have soem customers with the same key with different sources. And I have a variable created on customer. For ex - i have 3 cu
-
Problem downloading new version of firefox
got message saying firefox must closed to proseed with insallation please close firefox to continue
-
What settings should I use to "hold" emails on my Outlook email using SHAW.CA
My iPHONE6 is new this week. SHAW.CA technical support (x3) cannot make my settings on my iphone6 HOLD my EMAILS. They appear and in 1 minute they disappear. What settings should I have? I see they used EXCHANGE to set up my email while APPLE i
-
Recently, my iPod stops when the screen goes black...any ideas?
My iPod stops playing when the screen goes black. I have tried switching headphones, tried charging it, and tried resetting it...nothing has worked. Any ideas?
-
Target mode for Macbook Air? Data recovery effort underway
Hello, I took my daughters' Macbook Air into the Apple Store for the hinge replacement, they shipped it off for repair, and some idiot at the Apple repair Depot did a clean OS X install for absolutely NO reason. I want to access the hard drive as an