Send mail in HTML format
Is it possible with ODISendMail to send mail not in simple text but in HTML?
If no... how can I do that?
If you are looking for capturing the error in the HTML format that can be done by using odioutfile and save the file as HTML and use the required command at the message tab to capture the error .
in the Next step use - odisendmail attach the above html file as attached.
Similar Messages
-
How to send mail in HTML format using SMTP
I want to send mail in HTML format using SMTP.Can anybody please suggest how to do it.Can anybody send me the code.
Thnx.If you don't know how to send a message using JavaMail see here : http://developer.java.sun.com/developer/onlineTraining/JavaMail/contents.html#JavaMailSending
To send a html format mail you need to set the content type like this (msg is a javax.mail.internet.MimeMessage) :
String subject = "An Email 4 U";
String message = "<HTML><BODY>Here is a link<br><a href='http://javasoft.com'>Java</a></BODY></HTML>";
msg.setSubject(subject);
msg.setContent(message, "text/html");p.s This isn't really an advanced topic -
Send mail in HTML Format in Service Desk
Dear Friends,
We want to send email in html format to every user in service desk, how can we figure it?
Thanks in advance
Regards,Hello Eray,
You will want to have a look at this document and hopefully it will assist you accomplish what you need.
http://service.sap.com/~sapidb/011000358700001903822008E
Regards,
Paul -
How to send mails in HTML format from the send mail step of workflow?
Hi,
I have a requirement where I need to send mails in the html format from the send mail step of the workflows.
But what I found out that the html tags are not renderd and as such the output is in plain text.
I know that there is an alternative of using an activity step and use my own custom code from within there,But due to certain business constraints, I need to use the send mail step only.
My SCOT settings are all right.
Please let me know how it can be done.
Thanks,
Samrat.Samrat,
It can't be done, you have to use your own activity step.
What are these constraints that refrain you from doing that?
Rgds,
Patrick -
How to send mail in html format in jsp???
Hello everybody,
I have two jsp pages.In one page I have the heading like Date,Transaction.I am retriving data from my second jsp page.And I hae included the second jsp page to my first jsp page.How to send mail this content in html format.
Thanks
SrikantMimeMessage m = new MimeMessage(session);
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(content, "text/html");this if u need to send a mail content as html -
How to send mail using HTML format using tags
Hello experts,
I am currently using FM SO_NEW_DOCUMENT_SEND_API1 to send e-mails to our users' Outlook accounts. Now, I converted its document type from 'RAW' to 'HTM'. I enclosed my texts in HTML tags. But the problem is, I cannot see a thing when I check my message in SCOT. It just opens internet explorer and thats it. Anyway, Below is my code:
get e-mail addresses of controllers in table ZSHIPTO_EMAIL
SELECT * FROM zshipto_email
INTO TABLE it_zshipto_email
WHERE zevent = '2'.
IF sy-dbcnt > 0.
IF NOT it_del_entries[] IS INITIAL.
CLEAR lv_contents.
maildata-obj_name = 'Record Deleted in table ZTS0001'.
maildata-obj_descr = 'Record Deleted in table ZTS0001'.
maildata-obj_langu = sy-langu.
records deleted in ZTS0001 and ZTS_STPGEOLOC
CLEAR: lv_flag, lv_counter.
LOOP AT it_zshipto_email.
CLEAR: it_del_entries, mailtxt.
LOOP AT it_del_entries ASSIGNING <fs_del_entries>.
get name of dealer
SELECT SINGLE name1 FROM kna1
INTO <fs_del_entries>-name1
WHERE kunnr = <fs_del_entries>-kunnr.
IF lv_counter IS INITIAL.
CONCATENATE: '<p>'
'FYI: The ff record/s were deleted in tables'
'ZTS0001 and ZTS_STPGEOLOC by user' sy-uname
'</p>'
INTO lv_contents
SEPARATED BY space.
mailtxt-line = lv_contents.
APPEND mailtxt.
CLEAR: mailtxt, lv_contents.
ENDIF.
APPEND mailtxt.
CONCATENATE: '<p>'
'Dealer :' <fs_del_entries>-kunnr '-'
<fs_del_entries>-name1 '</p>'
INTO lv_contents
SEPARATED BY space.
mailtxt-line = lv_contents.
APPEND mailtxt.
CLEAR: mailtxt, lv_contents.
CONCATENATE: '<p>'
'Ship-To:' <fs_del_entries>-cdseq '</p>'
INTO lv_contents
SEPARATED BY space.
mailtxt-line = lv_contents.
APPEND mailtxt.
CLEAR: mailtxt, lv_contents.
CONCATENATE: '<p>'
'Address:' <fs_del_entries>-zaddress '</p>'
INTO lv_contents
SEPARATED BY space.
mailtxt-line = lv_contents.
APPEND mailtxt.
CLEAR: mailtxt, lv_contents.
CONCATENATE: '<p>'
'Contact person:' <fs_del_entries>-zcperson
'</p>'
INTO lv_contents
SEPARATED BY space.
mailtxt-line = lv_contents.
APPEND mailtxt.
CLEAR: mailtxt, lv_contents.
CONCATENATE: '<p>'
'Contact number:' <fs_del_entries>-zcnumber
'</p>'
INTO lv_contents
SEPARATED BY space.
mailtxt-line = lv_contents.
APPEND mailtxt.
CLEAR: mailtxt, lv_contents.
lv_counter = 1.
ENDLOOP.
APPEND mailtxt.
mailrec-receiver = it_zshipto_email-zemail.
mailrec-rec_type = 'U'.
APPEND mailrec.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = maildata
document_type = 'HTM'
put_in_outbox = 'X'
commit_work = '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.
CLEAR: mailtxt, mailrec, lv_counter.
REFRESH: mailtxt, mailrec.
ENDLOOP.
ENDIF.
Message was edited by: viraylabHi,
Check this...
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5931ff64-0a01-0010-2bb7-ff2f9a6165a0
Regards
vijay -
Hi All,
My requirement is to send emails. I am using javamail and it works fine. But the body of the email should be in table format.
I am planning to use Html as below. But don't know how to combine html in java. Is there any other way of achieving it ? Please let me know if I am not clear.
<htm>
<table border="1">
<tr>
<td bgcolor="red">Header</td>
</tr>
<tr>
<td bgcolor="yellow">Sub Header1</td>
<td bgcolor="yellow">Sub Header1</td>
</tr>
<tr>
<td bgcolor="green">Values</td>
<td bgcolor="green">Values</td>
</tr>
</html>so, do I need another method which tells Java whereto output the HTML Tags ?
The method writes to a PrintWriter defined somewhere,
you can also pass the PrintWriter as third argument
to the method.
To generate a String containg the whole HTML Dokument
you would write something like:
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new
PrintWriter(stringWriter);
writeStartTable();
writeStartRow();
writeCell("BlaBla", "green");
printEndTable();
printWriter.flush();
printWriter.close();
stringWriter.close();
String content = stringWriter().toString();
BodyPart mailBody = new MimeBodyPart();
mailBody.setContent(content, "text/html");
I was succesful in sending mail using HTML format. Thanks for ur reply.
But if I try send the mail in HTML format along with an attachment, the MIME type defaults to "text/plain".
Is there a way to set the MIME type to "text/html" when I send mail with an attachment.
Please help . Let me know if I am not clear -
How to send a mail in html format from a send mail workflow node ?
Dear all,
Do you know if it is possible to send an e-mail in HTML format (instead of RAW) from a "send mail" node in a workflow ? ... if "yes", please, let me know.
(I need to do that because I want to use the "href" tag to insert an hyperlink inside the e-mail)
- I haven't found any parameter to specify the format of the e-mail.
- Inside SCOT I tried to change the parameters for the SMTP node... without success.
- I don't want to use a task calling the FM SO_OBJECT_SEND.
NicolasHi Nicolas!
Have you tried to set "Output Format" for "RAW Text" to HTM in SCOT.
If HTM is missing in your dropdown-list, you could check out table SXCONVERT2. Copy the line with category T/format TXT, and change the format from TXT to HTM. The existing function
SX_OBJECT_CONVERT__T.TXT does not need to be changed. Now you should be able to choose HTM in SCOT. You will probably need som HTML-tags in your text to make it look good.
Hope this helps!
Regards
Geir -
How to send program output as mail in HTML format
Hi Friends,
I have a BDc which runs in background and its been Stored in my system and displayed as HTML format.
My requirement is now i want that Same HTML file which i am displaying to be sent as a mail in HTML format itself..Kindly help me on this
Thanks in advance
kishoreHi,
Below sample program might give you idea on sending HTML attachment.
TYPES: BEGIN OF t_sal_ord,
vbeln TYPE vbeln_va,
posnr TYPE posnr_va,
auart TYPE auart,
vkorg TYPE vkorg,
matnr TYPE matnr,
END OF t_sal_ord.
DATA: i_sal_ord TYPE STANDARD TABLE OF t_sal_ord,
i_header TYPE STANDARD TABLE OF w3head,
i_fields TYPE STANDARD TABLE OF w3fields,
i_html TYPE STANDARD TABLE OF w3html,
wa_header TYPE w3head.
DATA: i_fcat TYPE lvc_t_fcat,
wa_fcat TYPE lvc_s_fcat.
DATA: g_send_request TYPE REF TO cl_bcs,
g_document TYPE REF TO cl_document_bcs,
g_recipient TYPE REF TO cl_cam_address_bcs,
g_cx_bcs TYPE REF TO cx_bcs,
g_sent_to_all TYPE os_boolean.
DATA: g_lines TYPE i,
g_size TYPE so_obj_len.
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY,
p_mailad TYPE ad_smtpadr OBLIGATORY.
START-OF-SELECTION.
SELECT a~vbeln b~posnr a~auart a~vkorg b~matnr
INTO TABLE i_sal_ord
UP TO 20 ROWS
FROM vbak AS a
INNER JOIN vbap AS b
ON a~vbeln = b~vbeln
WHERE a~vkorg = p_vkorg.
wa_fcat-coltext = 'SalesOrd#'.
APPEND wa_fcat TO i_fcat.
wa_fcat-coltext = 'Item#'.
APPEND wa_fcat TO i_fcat.
wa_fcat-coltext = 'OrdType'.
APPEND wa_fcat TO i_fcat.
wa_fcat-coltext = 'Sales.Org'.
APPEND wa_fcat TO i_fcat.
wa_fcat-coltext = 'Material'.
APPEND wa_fcat TO i_fcat.
LOOP AT i_fcat INTO wa_fcat.
wa_header-text = wa_fcat-coltext.
CALL FUNCTION 'WWW_ITAB_TO_HTML_HEADERS'
EXPORTING
field_nr = sy-tabix
text = wa_header-text
size = '2'
fgcolor = 'BLACK'
bgcolor = 'VIOLET'
font = 'CALIBRI'
TABLES
header = i_header.
CALL FUNCTION 'WWW_ITAB_TO_HTML_LAYOUT'
EXPORTING
field_nr = sy-tabix
size = '2'
fgcolor = 'BLACK'
bgcolor = 'WHITE'
font = 'CALIBRI'
TABLES
fields = i_fields.
ENDLOOP.
wa_header-text = 'Sales Order Details'.
wa_header-size = '2'.
wa_header-font = 'CALIBRI'.
CALL FUNCTION 'WWW_ITAB_TO_HTML'
EXPORTING
* TABLE_ATTRIBUTES = 'BORDER=1'
table_header = wa_header
* ALL_FIELDS = 'X'
TABLES
html = i_html
fields = i_fields
row_header = i_header
itable = i_sal_ord.
TRY .
g_send_request = cl_bcs=>create_persistent( ).
g_document = cl_document_bcs=>create_document(
i_type = 'RAW'
* i_text = i_content[] " Body for Mail
i_subject = 'Sales Order Details' ).
DESCRIBE TABLE i_html LINES g_lines.
g_size = g_lines * 2 * 255.
CALL METHOD g_document->add_attachment
EXPORTING
i_attachment_type = 'HTM'
i_attachment_subject = 'Sales Order Details'
i_attachment_size = g_size
i_att_content_text = i_html[].
g_send_request->set_document( g_document ).
g_recipient = cl_cam_address_bcs=>create_internet_address( p_mailad ).
g_send_request->add_recipient(
EXPORTING
i_recipient = g_recipient
i_express = 'X' ).
g_send_request->set_send_immediately( 'X' ).
g_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = g_sent_to_all ).
COMMIT WORK.
CATCH cx_bcs INTO g_cx_bcs.
WRITE:/ g_cx_bcs->error_type.
ENDTRY.
Kind Regards
Eswar -
Send e-mail in HTML-format with attachment
Does function SO_OBJECT_SEND allow to send e-mail with attachment?
Does function SO_DOCUMENT_SEND_API1 allow to send e-mail in HTML format?Hi SS
See if you can understand this sample program
PARAMETERS: po_email TYPE AD_SMTPADR LOWER CASE.
DATA: li_objcont TYPE STANDARD TABLE OF solisti1,
li_reclist TYPE STANDARD TABLE OF somlreci1,
li_objpack TYPE STANDARD TABLE OF sopcklsti1,
li_objhead TYPE STANDARD TABLE OF solisti1,
li_content TYPE STANDARD TABLE OF solisti1,
lwa_objcont TYPE solisti1,
lwa_reclist TYPE somlreci1,
lwa_objpack TYPE sopcklsti1,
lwa_objhead TYPE solisti1,
lwa_content TYPE solisti1,
lwa_doc TYPE sodocchgi1,
l_lines TYPE i.
REFRESH: li_objcont[], li_reclist[],
li_objpack[], li_objhead[],
li_content[].
CLEAR: lwa_objcont, lwa_reclist,
lwa_objpack, lwa_objhead,
lwa_content, lwa_doc.
MOVE '<body>' TO lwa_objcont.
APPEND lwa_objcont TO li_objcont.
MOVE '<p>' TO lwa_objcont.
APPEND lwa_objcont TO li_objcont.
MOVE 'This is a sample HTML content from test program' TO lwa_objcont.
APPEND lwa_objcont TO li_objcont.
MOVE '</p>' TO lwa_objcont.
APPEND lwa_objcont TO li_objcont.
MOVE '</body>' TO lwa_objcont.
APPEND lwa_objcont TO li_objcont.
lwa_reclist-receiver = po_email.
lwa_reclist-rec_type = 'U'.
APPEND lwa_reclist TO li_reclist.
lwa_objhead = 'test.htm'.
APPEND lwa_objhead TO li_objhead.
lwa_content = 'Please find attached document for more details'.
APPEND lwa_content TO li_content.
CLEAR l_lines.
DESCRIBE TABLE li_content LINES l_lines.
READ TABLE li_content INTO lwa_content INDEX l_lines.
lwa_doc-doc_size = ( l_lines - 1 ) * 255 + STRLEN( lwa_content ).
lwa_doc-obj_langu = 'E'.
lwa_doc-obj_name = 'Test HTML file'.
lwa_doc-obj_descr = 'Test HTML file'.
CLEAR lwa_objpack-transf_bin.
lwa_objpack-head_start = 1.
lwa_objpack-head_num = 0.
lwa_objpack-body_start = 1.
lwa_objpack-body_num = l_lines.
lwa_objpack-doc_type = 'RAW'.
APPEND lwa_objpack TO li_objpack.
CLEAR: lwa_objpack, l_lines.
DESCRIBE TABLE li_objcont LINES l_lines.
READ TABLE li_objcont INTO lwa_objcont INDEX l_lines.
lwa_objpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( lwa_objcont ).
lwa_objpack-transf_bin = 'X'.
lwa_objpack-head_start = 1.
lwa_objpack-head_num = 0.
lwa_objpack-body_start = 1.
lwa_objpack-body_num = l_lines.
lwa_objpack-doc_type = 'HTM' .
lwa_objpack-obj_name = 'Test HTML file'.
lwa_objpack-obj_descr = 'Test HTML file'.
APPEND lwa_objpack TO li_objpack.
*Sending the mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc
put_in_outbox = 'X'
TABLES
packing_list = li_objpack
object_header = li_objhead
contents_bin = li_objcont
contents_txt = li_content
receivers = li_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
IF sy-subrc NE 0.
WRITE:/ 'Document sending failed'.
ELSE.
WRITE:/ 'Document successfully sent'.
COMMIT WORK.
ENDIF.
This should give you all you need to know to send an HTML file.
Thanks buddy -
Java.mail sending email in html format
I trying to send emails from my java program, I ve managd to send text mails, I want to send email in html format is there a way of doing that and how
thanks for your helpThanks a lot it is working now but I think that sending mails in text format is the best way since there isn't a way of knowing whether the recepient can handel html mails
-
Send Email in HTML Format with Javamail.
GOD BE BLESSED!
Hello dudes,
i create a jsp page let me send emails from a database using the API Javamail.
But these emails when i send then, goes in text format only, and i want to send emails in HTML format too. Anyone can help me?
I think the Javamail API can send in HTML format.
thanks and sorry, my english is basic but i think you understand. ;)
Adler MedradoI was trying to do the same thing...I found this on the java.sun.com website somewhere. Hope it works out for you.
try {
String host = "";
String from = "";
String to = "";
String fileAttachment = fileName;
// Get system properties
Properties props = new Properties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
Session session1 =
Session.getInstance(props, null);
// Define message
MimeMessage message =
new MimeMessage(session1);
message.setFrom(
new InternetAddress(from));
message.addRecipient(
Message.RecipientType.TO,
new InternetAddress(to));
message.setSubject("");
// create the message part
MimeBodyPart messageBodyPart =
new MimeBodyPart();
//fill message
messageBodyPart.setText("");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source =
new FileDataSource(fileAttachment);
messageBodyPart.setDataHandler(
new DataHandler(source));
messageBodyPart.setFileName(fileAttachment);
multipart.addBodyPart(messageBodyPart);
// Put parts in message
message.setContent(multipart);
// Send the message
Transport.send( message );
}catch (Exception e){
System.err.print("Mailing error:");
System.err.println(e); -
Send Email with HTML format in Outlook Macro
I can use the following to send email with HTML format in VBA. I also have created an HTML file. Is there a way to load the file into .HTMLBody to send it as HTML format message?
Set OutlookApp = CreateObject("Outlook.Application")
Set objMail = OutlookApp.CreateItem(olMailItem)
With objMail
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>Enter the message text here. </BODY></HTML>"
.Display
End WithTry:
Dim fso As Scripting.FileSystemObject
Dim htmlFile As Scripting.TextStream
Set fso = New Scripting.FileSystemObject
Set htmlFile = fso.OpenTextFile("C:\path\to\my-html-file.htm")
strInsert = htmlFile.ReadAll
then change:
.htmlbody = strInsert
oh, and you need to set a reference to the Scripting runtime in Tools, References.
Diane Poremsky [MVP - Outlook]
Outlook & Exchange Solutions Center
Outlook Tips
Subscribe to Exchange Messaging Outlook weekly newsletter -
Sending email in html format.
i am trying to send email in html format. the following is my sample code. it's just sending plain text. how should i send html file in email?
String message_body = "<a href=\"test.html\">click here</a>";
MimeMessage msg = new MimeMessage( session );
// From Address
msg.setFrom( new InternetAddress( fromAddress ) );
// TO Address
InternetAddress recipient_Address = new InternetAddress( toAddress );
msg.addRecipient(Message.RecipientType.TO, recipient_Address);
// Subject
msg.setSubject( subject );
// MimeBodyPart object for message body part
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText( message_body );
// MimeBodyPart object for file to attach
MimeBodyPart mbp2 = new MimeBodyPart();
Multipart mp = new MimeMultipart();
// create the Multipart and add message body and file to attach.
mp.addBodyPart(mbp1);
// add the Multipart to the message
msg.setContent(mp);
msg.setSentDate(new Date());
// send the message
Transport.send(msg);
i'd appreciated it...msg.setContent(mp, "text/html");Have I put this in the right place? You need to apply it to your body text, at any rate.
-
How to send the body of mail in html format using servlet
Hi
i developed an servlet using sun.net.smtp.SmtpClient package,my servlet receiving data from an form,i can able to send mail successfully,but my mail body part is in the text format,but i would like to send it as an html format,for ex <input type="text" size="25" name="Name"> as an input field with value received from the form instead of showing tags as i mentioned<input type="text" size="25" name="Name"> ,any help would be appreciated.
Regards.See this program
But here whats the problem is ,
some maiservers doesnot support html code if u send this mail to yahoo account it will show html code as it is,
hotmail account encodes the html and shows proper fonts and headings
import java.io.*;
import java.util.*;
import java.net.*;
import sun.net.smtp.SmtpClient;
public class SendMail {
public static void main(String args[]){
int i = 0;
//while (true) {
SmtpClient mail;
try{
i++;
String email = "[email protected]";
String from="[email protected]";
mail=new SmtpClient("bizpivot.com");
mail.from(from);
mail.to(email);
PrintStream msg=mail.startMessage();
msg.println("To: " +email);
msg.println("Subject: Hai" i "!!!");
msg.println("<html><head><title>Untitled</title></head><body bgcolor='red' text='#00ffff'><font face='Courier New' size='+3'>Hai How are you Man!!!</font></body></html>");
mail.closeServer();
System.out.println(i);
catch(Exception e){e.printStackTrace();}
Maybe you are looking for
-
Urgent question pls :( [Related in Syncing and backing up all library~
ok im planning to buy a new laptop, but I have a question. I have desktop pc which is all my music/apps/movies are stored, then how to put my whole library to another computer? *cheers mate*
-
Is the OSX lion compatible with ipad 2
Is osx compatible with ipad2 because i really want it but i havent got an imac
-
Leading zero was lost in spool when ALV print out
When run a ALV report and print out in background job,the leading zero is lost e.g.: vendor (type c) 0000000001 In spool: 1.. How to show the leading zero when printing out ? Thanks in advance
-
Take a chance on an MDD?
Hi. Here's a challenge for you all. I've got the opportunity to buy an MDD 1 GHz 2DP with the following description (not written by yours truly): Unit is missing its memory, video card, hard drive, cd-rom and the little battery that sits on the board
-
Persisting a geometric layout in Flex
Hi All, I have an application where i have a few icons embedded on buttons. I drag and drop them onto a canvas and connect them by drawing lines between them. Once i do this, i want to save this configuration or geometrical layout to the database, so