How send HTML MAIL writing to port 25
I�m already sending mails writing to port 25 but how can I format now the mail with html code in the same way, writing to port 25?
Here is some code that I use:
Properties props = new Properties();
props.put( "mail.smtp.host", smtpHostName );
Session session = Session.getDefaultInstance( props, null );
try
MimeMessage msg = new MimeMessage(session);
msg.setFrom( "Blah <[email protected]>" );
msg.setRecipients( Message.RecipientType.TO, "Blarg <[email protected]>" );
msg.setSubject( "Boo!" );
msg.setSentDate(new java.util.Date());
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText( "Boo" );
Multipart mp = new MimeMultipart( "alternative" );
mp.addBodyPart(mbp1);
MimeBodyPart mbp2 = new MimeBodyPart();
StringBuffer buf = new StringBuffer();
buf.append( "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n" );
buf.append( "<html>\n<head>\n<title>\n" );
buf.append( "Boo!" );
buf.append( "</title></head><body>" );
buf.append( "<b>Boo!</b>" );
buf.append( "</body></html>" );
mbp2.setContent( buf.toString(), "text/html; charset=us-ascii" );
mp.addBodyPart(mbp2);
msg.setContent(mp);
Transport.send(msg);
catch( MessagingException mex )
// handle error
}
Similar Messages
-
How to send HTML mail with images multipart/related message
Hi,
Could any body tell me how to send HTML mail with images in "multipart/related" message,if any body can give the code ,it would be helpful.
ThanksHi,
Could any body tell me how to send HTML mail with
ith images in "multipart/related" message,if any body
can give the code ,it would be helpful.
ThanksHi!
Refer to
http://developer.java.sun.com/developer/onlineTraining/JavaMail/index.html
I've found it very helpful.
Look at the last part for a code showing how to send HTML mail!
Regards -
Isn't it possible to send Html Mail through navigateToUrl() with contentType "text/html" for Android ? please suggest any workaround
ThanksAHHHH
What you can do to make HTML for Apple Mail is to make it in an HTML editor, open it with Safari use CMD+i - a new mail message will appear in a moment with the web page in the email body.
You can't do any major editing in Mail, you'll have to go back to the HTML file. But it works.
You can also use Copy (from a web page) and then (Edit) Paste as HTML (that what Paste as HTML is for, not for creating HTML email). You can also user Paste as HTML to copy/paste a HTML email you receive or part of a HTML email. -
I've created what the php manual says should work to send
html mail to our customer automatically from the website after a
purchase, along with headers to send a bcc to us.
But the finished product coming out of DW is a message body
with all the code tags and headers in the body of the email, not a
nice html email.
I originally created this in GL, and have brought it over to
DW.
Is there maybe a better way to do this?
Here's my code:That should work fine, I believe.
But there are commercial products that may be what you would
want to
consider. WebAssist has one called UniversalEmail, that I
like very much -
http://www.webassist.com
It will allow you to send both an HTML and a plain text
email. I use it
frequently.
I have an affiliate link on my website, and if you are
interested, please
use that -
http://www.great-web-sights.com
(I am not an employee of WebAssist, but I do use/like their
products)
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"rlinsurf1" <[email protected]> wrote in
message
news:[email protected]...
> I've created what the php manual says should work to
send html mail to our
> customer automatically from the website after a
purchase, along with
> headers to
> send a bcc to us.
>
> But the finished product coming out of DW is a message
body with all the
> code
> tags and headers in the body of the email, not a nice
html email.
>
> I originally created this in GL, and have brought it
over to DW.
>
> Is there maybe a better way to do this?
>
> Here's my code:
>
>
> <?php
>
> $message = '<html>
>
> <head>
> <meta http-equiv="content-type"
content="text/html;charset=utf-8" />
> <style type="text/css" media="all"><!--
> .dsR5 /*agl rulekind: base;*/ { width: 645px; height:
75px; }
> .dsR6 /*agl rulekind: base;*/ { width: 645px; height:
158px; }
> .emailtext { color: gray; font-size: 10pt; font-family:
Verdana, Arial,
> Helvetica, sans-serif; }
> .headertext { color: gray; font-size: 14pt; font-family:
Verdana, Arial,
> Helvetica, sans-serif; font-weight: bold; }
> .ds4 /*agl rulekind: base;*/ { font-size: 15px; }
> .ds10 /*agl rulekind: base;*/ { font-size: 12px; }
> --></style>
> </head>
>
> <body>
> <p><img class="dsR5"
>
src="https://ssl21.pair.com/grndlvl/commerce/gl/images/GRLogo.gif"
alt=""
> border="0" /></p>
> <p class="headertext">Groundlevel Store
Order</p>
> <table class="dsR6" border="0" cellspacing="0"
cellpadding="0">
> <td><span
class="emailtext">Name:</span></td>
> <td class="emailtext"><?php echo $fullname;
?></td>
> </tr>
> <tr>
> <td><span class="emailtext">Email
Address:</span></td>
> <td class="emailtext"><?php echo $email;
?></td>
> </tr>
> <tr>
> <td><span
class="emailtext">Date:</span></td>
> <td class="emailtext"><?php echo $orderdate;
?></td>
> </tr>
> <tr>
> <td><span
class="emailtext">Product:</span></td>
> <td class="emailtext"><?php echo
$item;?></td>
> </tr>
>
> <tr>
> <td><span
class="emailtext">Total:</span></td>
> <td class="emailtext"><?php echo$total;
?></td>
> </tr>
>
> </table>
> <p class="headertext"><span
class="ds4">Thank You for Your
> Order</span></p>
> <p class="headertext"><span class="ds10">You
can expect your order to be
> delivered promptly. You will also receive notifcation of
your shipment
> along
> with the tracking information from the carrier you
selected for delivery,
> either USPS, UPS or Fedex. If you have any questions
about your order,
> please
> email us at:
[email protected].</span></p>
> </body>
>
> </html>';
>
> $headers = 'MIME-Version: 1.0' . "\r\n";
> $headers .= 'Content-type: text/html;
charset=iso-8859-1' . "\r\n";
> $headers .= 'From: Groundlevel Store
<[email protected]>' . "\r\n";
> $headers .= 'Bcc: [email protected]' . "\r\n";
>
>
> mail($email,"Your Groundlevel Store Order",$message,
$headers) // this
> line is
> the ending tag
>
> ?>
> -
Hi there,
I'm trying to send html mail with an image. I'm able to see the image but in another section, at the very bottom of my message. Is it possible to display the image in the main part of my message ?
Here my code :
MimeMultipart multi = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
String htmlText = <H1>Test</H1><img src=\"cid:image\">";
messageBodyPart.setContent(htmlText, "text/html");
multi.addBodyPart(messageBodyPart);
MimeBodyPart imagePart = new MimeBodyPart();
DataSource fds = new FileDataSource("C:\\Resources\\Templates\\logo.jpg");
imagePart.setFileName( "geologo.jpg" );
imagePart.setDataHandler(new DataHandler(fds));
imagePart.setHeader("Content-ID","<image>");
multi.addBodyPart(imagePart);
msg.setContent(multi);
Transport.send(msg);How many different e-mail clients have you tested that with?
-
Sending HTML Mails using SO_DOCUMENT_SEND_API1
Dear all,
we were using SO_DOCUMENT_SEND_API1 to send plain text e-mail replies to participants of an incentive program. Now the customer wants to send HTML mails. Customer has provided HTML templates for the mails, and the text always is the same, only slight changes in regard to the particpants number occur. Has anybody ever performed sending HTML formated mails without using SmartForms?
Thanks for your help!
Kind Regards
ChrisSure.. here is a sample program.
report zrich_0002.
data: maildata like sodocchgi1.
data: mailtxt like solisti1 occurs 10 with header line.
data: mailrec like somlrec90 occurs 0 with header line.
start-of-selection.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
perform build_text_message.
perform build_receivers.
perform send_mail_nodialog..
* Form BUILD_TEXT_MESSAGE
form build_text_message.
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test Subject'.
mailtxt = '<html>'.
append mailtxt.
mailtxt = '<head>'.
append mailtxt.
mailtxt = '<title>Untitled Document</title>'.
append mailtxt.
mailtxt = '<meta http-equiv="Content-Type" content="text/html;'.
append mailtxt.
mailtxt = 'charset=iso-8859-1">'.
append mailtxt.
mailtxt = '</head>'.
append mailtxt.
mailtxt = '<body>'.
append mailtxt.
mailtxt = '<div align="center"><em><font' .
append mailtxt.
mailtxt = 'color="#0000FF" size="+7" face="Arial,'.
append mailtxt.
mailtxt = 'Helvetica, sans-serif">THIS'.
append mailtxt.
mailtxt = ' IS A TEST </font></em><font' .
append mailtxt.
mailtxt = 'color="#0000FF" size="+7" face="Arial,'.
append mailtxt.
mailtxt = 'Helvetica, sans-serif"></font>'.
append mailtxt.
mailtxt = '</div>'.
append mailtxt.
mailtxt = '</body>'.
append mailtxt.
mailtxt = '</html>'.
append mailtxt.
endform.
* Form BUILD_RECEIVERS
form build_receivers.
* mailrec-receiver = '[email protected]'.
mailrec-rec_type = 'U'.
append mailrec.
endform.
* Form SEND_MAIL_NODIALOG
form send_mail_nodialog.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'HTM'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform.
Regards,
Rich Heilman -
Using Safari to send HTML Mail message but Mail keeps dropping images?
I'd like to use Safari to send html Mail messages, but when I click on File>Mail Contents... Mail opens a new window but my graphics are gone. (I'm creating the html pages using MS Word for the Mac.) I get a flash of the graphics for a second, and then they are replaced by a little blue lego. Any ideas? I've tried all kinds of mail preferences but nothing seems to help.
Figured it out (at least one way): had to load the image to a server and then add the image as a link only (uncheck "save picture with document" box).
-
Send html mail with apple mail
I used to send a html newsletter with apple mail. I opened the html file in safari pressed cmd + i and a html mail was created. On Yosemite there seems to be a bug with this feature. After pressing cmd + i it creates a mail and html website is selected in this mail, but the mail body is empty. Now I have no ideo how to send the newsletter. Apple mail was the only way to achive a correctly displayed newsletter on most common mail clients.
Does anyone have the same problem or a solution?Seems to be a bug in Safari under Yosemite. Occurs only with HTML pages which are stored locally on the Mac and then opened with Safari.
Two options for a work around:
(1)
When Apple Mail shows a blank page, choose PDF instead of WEB PAGE in the mail header.
Thereafter, the contents will appear as a PDF attachment.
(2)
Publish the HTML page. Surf with Safari to the published page. Use the command "File : Send : Email this page".
Now it should work. -
Hi
Does anybody knows how to send a HTML mail with flash to a
person?
grtz
TomHi!
You need to use a serverside script like php or asp. I have a
html string in
the swf which I send as LoadVars.send() to the server.
Of cource the server has to be configured correctly to
support the mail
function.
//Micke
"MatMaar" <[email protected]> skrev i
meddelandet
news:e3atb2$c2r$[email protected]..
> Hi
>
> Does anybody knows how to send a HTML mail with flash to
a person?
>
> grtz
> Tom -
When sending html mail from ocfo or direct telnet smtp_in returns an error
<lots of markup/>
......<snip>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt"><o:p> </o:p></SPAN></FONT></P></DIV></BLOCKQUOTE></BODY></HTML>
500 5.6.0 Data command failed: too many headers
550 5.7.1 Closing connection
Connection closed by foreign host.
Has anyone seen this problem? I get the feeling that smtp_in is counting every html tag as a header, should I increase the "Maximum Number of Headers Allowed in a Message" parameter in smtp_in to fix this problem? If so what might be a reasonable setting? I increased it from 1000 to 2500 but could not get a particular email to send. Small amounts of HTML send ok.
thanks!OK, I think I have narrowed this to a problem somewhere between the listener and SMTP_IN. This problem only occurs when using SMTP over SSL. I switched my two SMTP_IN processes, I made the non-SSL into SSL and vice-versa. The problem followed the process with the SSL configuration. I have no idea what in the listener configuration (or the smtp_in config as its shown through em) could caused this kind of problem. Small html mails with basic markup in them work fine over SMTP SSL, but big html mails with lots of nasty markup alway fail, they just stay in the outbox and then ofco needs several folder refreshes (or restart) in order to be able to again view any of the "mail" type folders (imap).
Thunderbird also has these symptoms minus the need to refresh/restart after a failed html mail sending attempt.
Anyone seen/seeing anything like this? -
Sending HTML mail using code in workflow
Hi All
I follow somerecomendation to create a program to send the mail out. using a program
My code looks as the following.
DATA: l_docdata TYPE sodocchgi1,
li_content TYPE TABLE OF solisti1,
li_receiver TYPE TABLE OF somlreci1,
l_ename TYPE pa0002-cname,
l_text(255),
lw_receiver TYPE somlreci1.
l_docdata-obj_name = 'Notification'.
l_docdata-sensitivty = 'P'.
l_docdata-proc_syst = sy-sysid.
l_docdata-proc_clint = sy-mandt.
l_docdata-obj_descr = 'TEST'.
l_text = 'Testing Content'.
APPEND l_text TO li_content. CLEAR l_text.
lw_receiver-receiver = 'MyMailtest@GM ail.com'.
lw_receiver-rec_type = 'U'.
APPEND lw_receiver TO li_receiver.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = l_docdata
commit_work = 'X'
DOCUMENT_TYPE = 'HTM'
TABLES
object_content = li_content
receivers = li_receiver
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.
I try to use the code above and i manage to send the mail out. However when i change the l_text = 'Testing Content' to l_text = '<A HREF="http://www.google.com">Click Here</A>' , it does not reach my mailbox even in in transaction SCOT, i can see that it was succesfully transmited.
Anyone have any idea about this?
Thanks.
Regards,
Bryan.Hey PJ,
I manage to send out the email using the htm type. However, instead of having a hyperlink saying click here and it link to another page, i am getting something like this in the email.
Click Here <http://www.google.com>
In my code, i write
<A HREF="http://www.google.com">Click Here</A>
, but the content just turn to above. What i wan is a CLICK HERE link and will link to google.
Thanks.
Regards,
Bryan. -
Send html mail with navigateToURL(new URLRequest('mailto:
hi!
do you think its possible, to send html text to the email client of the mobile device?
i tried different ways, but without success.
Way 1
navigateToURL(new URLRequest('mailto:[email protected]'+'?subject=Subject'+'&body= <html><body>Hello world<br><img src="http://www.republicofcode.com/wp-content/uploads/2012/04/Pins2_300_250.png"></body></html>'));
Way 2
var hdr:URLRequestHeader = new URLRequestHeader("Content-type", "text/html");
var request:URLRequest = new URLRequest('mailto:[email protected]?subject=Subject&body=<html><body>Hello world<br><img src="http://www.republicofcode.com/wp-content/uploads/2012/04/Pins2_300_250.png"></body></html>');
request.requestHeaders.push(hdr);
navigateToURL(request);
Maybe i need another content type than text/html?
In the reference i've read, that the default one is: application/x-www-form-urlencoded
http://help.adobe.com/de_DE/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.ht ml#contentType
Any ideas?you could try:
function submitPoll(e:MouseEvent):void {
//sending the email stuff
var request:URLRequest = new URLRequest("mailto:[email protected]"+"?subject=Subject"+"&body= Hello world ");
navigateToURL(request, "_blank");
request.method = URLRequestMethod.POST; -
Hi experts and gurus,
how can I send an HTML email which is displaying an image in the HTML context (table)?
I'm using the 'SO_NEW_DOCUMENT_SEND_API1' like below:
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = ls_doc_data
document_type = 'HTM'
put_in_outbox = 'X'
commit_work = 'X'
TABLES
object_content = gt_mail_body
receivers = gt_receiver .
I think that might switch to function module 'SO_NEW_DOCUMENT_ATT_SEND_API1', but I have no clue how to set up the PACKING_LIST properly and to incorporate the image into the HTML code afterwards.
Can anybody help me?
Regards, SteffenHi,
I am also trying to send the image in the mail body but the image is not being displayed in the mail.
I am using cl_bcs class to send the image as the attachment in the mail and the body content but the
image is not being displayed instead all I can see a box with red cross however, the attached gets open.
But it is not able to find the image source I guess.
I am using Lotus notes to check the mail.
Please help me ......
I am uploading the image file from desktop into my code then I am attaching it in the mail.
Please let me know the solution
The code is as follows :
REPORT ztest_mail_544.
DATA: l_send_request TYPE REF TO cl_bcs,
l_document TYPE REF TO cl_document_bcs,
l_sender TYPE REF TO cl_sapuser_bcs,
l_sub TYPE char50,
l_recipient TYPE REF TO if_recipient_bcs,
tl_contents TYPE STANDARD TABLE OF soli,
tl_reciev TYPE STANDARD TABLE OF somlreci1,
lp_encrypt TYPE bcsd_encr,
wa_contents TYPE solisti1,
l_doc_len TYPE so_obj_len,
l_cnt TYPE sy-tabix,
l_rcv_email TYPE adr6-smtp_addr,
l_result TYPE sy-binpt,
l_bcs_exception TYPE REF TO cx_bcs,
l_subj TYPE string,
l_doc TYPE REF TO cl_document_bcs,
e_result TYPE sr_state,
ls_receivers TYPE somlreci1,
ll_text TYPE uname.
DATA filename TYPE string .
DATA : it_tab TYPE solix_tab.
filename = 'C:\Documents and Settings\Desktop\otter.jpg'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
filetype = 'BIN'
TABLES
data_tab = it_tab
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
wa_contents-line = 'Mail containing pics <br/>'.
APPEND wa_contents TO tl_contents.
CLEAR wa_contents.
wa_contents-line = '<p><img src="otter.jpg" width="304" height="228"></img > </p><br/>'.
APPEND wa_contents TO tl_contents.
TRY.
*-- Create persistent send request
l_send_request = cl_bcs=>create_persistent( ).
tl_contents[] = it_mail_body[].
*-- Get the length of the Document
DESCRIBE TABLE tl_contents LINES l_cnt.
READ TABLE tl_contents INTO wa_contents INDEX l_cnt.
l_doc_len = ( l_cnt - 1 ) * 255 + STRLEN( wa_contents ).
*-- Subject of the mail
CLEAR l_sub.
l_sub = 'test mail for image'.
l_document = cl_document_bcs=>create_document(
i_type = 'HTM'
i_text = tl_contents
i_length = l_doc_len
i_subject = l_sub
i_language = sy-langu
i_importance = '9' ).
*-- Add document to send request
CALL METHOD l_send_request->set_document( l_document ).
*-- Don't send delivery info for successful mails
CALL METHOD l_send_request->set_status_attributes
EXPORTING
i_requested_status = 'E'
i_status_mail = 'A'.
*-- Set sender
l_sender = cl_sapuser_bcs=>create( 'HR_SUPPORT' ).
CALL METHOD l_send_request->set_sender
EXPORTING
i_sender = l_sender.
DATA : i_attachment_type TYPE soodk-objtp,
i_attachment_subject TYPE sood-objdes .
DATA : t_attachment TYPE STANDARD TABLE OF solix.
TRY.
l_att_type = i_attachment_type.
l_subject = i_attachment_subject.
i_attachment_type = 'jpg'.
t_attachment[] = it_tab[].
l_doc = l_document .
i_attachment_type = space.
i_attachment_subject = 'otter.jpg'.
CALL METHOD l_doc->add_attachment
EXPORTING
i_attachment_type = i_attachment_type
i_attachment_subject = i_attachment_subject
i_att_content_hex = t_attachment.
CATCH cx_document_bcs.
ENDTRY.
l_recipient = cl_cam_address_bcs=>create_internet_address('xyz @abc.com' ).
CALL METHOD l_send_request->add_recipient
EXPORTING
i_recipient = l_recipient
i_express = 'X'
i_copy = ''
i_blind_copy = ''.
IF sy-subrc = 0.
ENDIF.
CALL METHOD l_send_request->set_send_immediately( 'X' ).
*-- Send Email
CALL METHOD l_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = l_result ).
COMMIT WORK.
CATCH cx_bcs INTO l_bcs_exception.
write : 'mail not sent '. -
How send e-mail with XML + PDF and body text
Hi everyone,
I have a new requirement but I´m with doubts, how to send an e-mail with two attachements (XML and PDF) and body text using -
MIME: multipart/mixed;boundary
I already have code to send XML + body text as you can see below:
Element contentType = docout.createElement("Content_Type");
root.appendChild(contentType);
Text contentTypeText = docout.createTextNode("multipart/mixed;boundary=--AaZz");
absTraceLog.addDebugMessage("Content_Type e-mail --- "+contentTypeText.toString());
contentType.appendChild(contentTypeText)
String text = "----AaZz\r\nContent-Type: text/plain; charset=UTF-8\r\n" +
"Content-Disposition: inline\r\n\r\n" + nfeText +
"\r\n----AaZz\r\nContent-Disposition: attachment; filename="+ prefixo +" "+ chaveNFe +".xml" +"\r\n\r\n" + xmlString + "\r\n";
Element content = docout.createElement("Content");
root.appendChild(content);
contentText = docout.createTextNode(text);
Content.appendChild(contentText);
The code above work good, but I can´t duplicate any field from XiMail 3.0 - because it´s 0:1.
So how to do that ?
Thanks.
Regards,
BR.
Viana.Eng,
That´s works good with mailPackage:
content= "--" + "--Zz" + CRLF
+ "Content-Type: text/html; charset=UTF-8" + CRLF
+ "Content-Disposition: inline" + CRLF + CRLF
+ textBodyMail + CRLF
+ "--" + "--Zz" + CRLF
+ "Content-Type: application/xml; name=" + attachmentName + CRLF
+ "Content-Disposition: attachment; filename=" + attachmentName + CRLF
+ "Content-Transfer-Encoding: base64" + CRLF + CRLF
+ encoder.encode(inputString.getBytes("UTF-8")) + CRLF
+ "--" + "--Zz" + CRLF
+ "Content-Type: application/pdf; name=" + pdfName + CRLF
+ "Content-Disposition: attachment; filename=" + pdfName + CRLF
+ "Content-Transfer-Encoding: base64" + CRLF + CRLF
+ encoder.encodeBuffer(new BASE64Decoder().decodeBuffer(pdfAttachment));
Regards,
BR.
Ricardo Viana. -
Sending HTML mail doesn't work
Hi experts,
I'm trying to send an HTML eMail by using function module 'SO_NEW_DOCUMENT_SEND_API1'.
Without success! When I debug the code, the format os switched from HTM to RAW and I have no clue why.
Here's my code:
data objpack like sopcklsti1 occurs 2 with header line.
data objhead like solisti1 occurs 1 with header line.
data objbin like solisti1 occurs 10 with header line.
data objtxt like solisti1 occurs 10 with header line.
DATA ls_doc_send TYPE sodocchgi1.
ls_doc_send-obj_name = 'Exp.Auth. Notif.'.
ls_doc_send-obj_descr = 'Expiring Authentication Notification'.
ls_doc_send-sensitivty = 'O'.
ls_doc_send-obj_langu = 'E'.
DESCRIBE TABLE i_mailtext LINES lv_int_send.
READ TABLE i_mailtext into lv_last_line INDEX lv_int_send.
ls_doc_send-doc_size = ( lv_int_send - 1 ) * 255 + STRLEN( lv_last_line ).
CLEAR objpack-transf_bin.
* objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
DESCRIBE TABLE i_mailtext LINES tab_lines.
objpack-body_num = tab_lines.
objpack-doc_type = 'HTM'.
objpack-doc_size = ls_doc_send-doc_size.
APPEND objpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = ls_doc_send
document_type = 'HTM'
PUT_IN_OUTBOX = 'X'
commit_work = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
TABLES
object_header = objhead
object_content = i_mailtext
* CONTENTS_HEX = i_mailtext
* OBJECT_PARA =
* OBJECT_PARB =
receivers = i_receiver
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.
The parameter i_Mailtext is the prepared HTML document. Do oyu know which HTML elements/tags are mandatory?
objhead and objbin are not set, should I?
Thanks and regards,
SteffenHi,
try This u ill get some idea ..
data: maildata like sodocchgi1.
data: mailtxt like solisti1 occurs 10 with header line.
data: mailrec like somlrec90 occurs 0 with header line.
start-of-selection.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
submit ztestalv02 and return.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'HTM'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
if sy-subrc = 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Regards...
if not let me know.
Maybe you are looking for
-
Data Quality Services - Summary report
Hi, Is anyone has a idea about which table is stored summary information comming out from Activity monitor? the example is below: when I exported the data the summary as follows: My pourpose is to automate this report if it is stored on DQS data bas
-
please help
-
Passing a file from one page to another
Hello, I have a page in the application, which uploads a file. I need to pass this file to another page, where it's going to be inserted in the table with some other parameters. Is there a way to do it in Apex? for example a temporally table that cou
-
How to implement Inline Views in ODI?
Hi, How to implement the following query (inline view) in ODI? Query: SELECT * FROM Table_one t1, (SELECT * FROM Table_two (includes some where conditions) t2 WHERE conditions; How to set the conditions at the table level (not at the interface level)
-
Setting a global display variant
While I try to get the report for IH08,I am trying to set a layout,but there only user specific and default display layout is present. I am not able to create it globally? Is there a way?