Error in HTML Format Mail

I want to send mail in html format. i am using java mail api.
but i am getting this error for my programe.
Can nebody tell me how to send mail in html format
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/SharedByteArrayInputStream
I think problem is somewhere in this part of code..
InternetAddress internetaddress = new InternetAddress("[email protected]");
InternetAddress internetaddress1 = new InternetAddress("[email protected]");
MimeMessage mimemessage = new MimeMessage(session);
mimemessage.setFrom(internetaddress);
mimemessage.setRecipient(javax.mail.Message.RecipientType.TO, internetaddress1);
mimemessage.setSubject("Posting Mail");
mimemessage.setContent(subject, "text/html");
Transport.send(mimemessage);

Hi Varun .
While going thru your code i felt that your are missing something in your code . but i did not checked it . anyways first u check that u have set your class path to the mail.jar and mailapi.jar properly. then check whetehre u have imported everything properly or not .I am attachimg my piece of code which i used recently to send mails. I hope this will work . Do get back to me after you try this block of code
try{
Properties props = System.getProperties();
props.put("mail.smtp.host", "111.11.1.11");// you smtp servers ip address
Session session = Session.getDefaultInstance(props, null);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("x@enigma"));//senders address
msg.setSubject("Testing");//subject of mail
msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
// Receiptents address
String body="<html><body><H1> Welcome to Java Mail</body></html>";//creating and html body
msg.setContent(message,"text/html");//setting the content of HTML
Transport.send(msg);/ sending mails
}catch (AddressException ae) {               
System.out.println("Address Exception=="+ae);
}catch (MessagingException me) {
System.out.println("MessagingException"+me);
}catch (Exception e) {
System.out.println("Exception"+e);
}

Similar Messages

  • How to send HTML Format Mail using Java Mail in oracle 9i Forms

    Dear All
    could you please tell me how to send HTML Format Mail using Java Mail in oracle 9i Forms and how to implement the java mail ?
    if it is possible, could you please send me the sample code? please very urgent
    Thanks
    P.Sivaraman

    Hello,
    <p>Here is a Form sample.</p>
    Francois

  • HTML format mail from UTL_SMTP

    Hi ,
    I am on Oracle 8.1.7 on Unix. I am using utl_smtp package to send emails from database and successfully sending plain text emails.
    I want to send HTML formatted mails. How can I do that ?
    Please suggest .
    Regards

    I have used the package bu I have not uset it to send
    e-mails with HTML Format. Check from the page 1807.
    UTL_SMTP
    http://download-east.oracle.com/docs/cd/B10501_01/appdev.920/a96612.pdf
    Joel P�rez

  • Error when sending HTML format mail from Oracle 9i forms

    Dear All,
    i have created one procedure with 15 in parameter by which i can send mail in HTML format. due to length problem i am using 15 parameter, every parameter has length 32767, i am splitting HTML coding after every parameter length fulfilled
    when 3 or 4 parameter only fulfilled mail comes well, but more than 4 parameter fulfilled mail is not coming, will any one of you kindly please help me to resolve this
    following procedure i am using.......
    PROCEDURE P_SEND_MAIL( subject_p varchar2, salutation_p varchar2, plan_hdr_msg_p varchar2,
    plan_dtl_msg_p_1 varchar2, plan_dtl_msg_p_2 varchar2, plan_dtl_msg_p_3 varchar2, plan_dtl_msg_p_4 varchar2,
    plan_dtl_msg_p_5 varchar2, plan_dtl_msg_p_6 varchar2, plan_dtl_msg_p_7 varchar2, plan_dtl_msg_p_8 varchar2,
    plan_dtl_msg_p_9 varchar2, plan_dtl_msg_p_10 varchar2, plan_dtl_msg_p_11 varchar2, plan_dtl_msg_p_12 varchar2,
    plan_dtl_msg_p_13 varchar2, plan_dtl_msg_p_14 varchar2, plan_dtl_msg_p_15 varchar2, summary_p varchar2,
    cmplmntry_sign_msg_p varchar2, mailto_p varchar2 ) IS
    mail_from varchar2(100);
         mailhost varchar2(30) := 'MAIL-SRVR';
         crlf varchar2(10) := CHR(13)||CHR(10);
         mess_bdy varchar2(10000);
         Port number := 25;
         conn UTL_SMTP.CONNECTION;
    begin
         mail_from := 'IT-Department';
         mess_bdy := 'Date: ' ||TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' )|| crlf ||
         'From:' ||mail_from|| crlf ||
         'Subject:'||subject_p|| crlf ||
         'To: ' ||mailto_P|| crlf ||'' || crlf;
         conn:= utl_smtp.open_connection( mailhost, Port );
         utl_smtp.helo( conn, mailhost );
         utl_smtp.mail( conn, mail_from);
         utl_smtp.rcpt( conn, mailto_P );
         utl_smtp.data( conn, 'MIME-Version: 1.0' ||CHR(13)|| CHR(10)||
         'Content-type: text/html' || CHR(13)||CHR(10)||
         mess_bdy||salutation_p||plan_hdr_msg_p
         ||plan_dtl_msg_p_1||plan_dtl_msg_p_2||plan_dtl_msg_p_3||plan_dtl_msg_p_4||plan_dtl_msg_p_5
         ||plan_dtl_msg_p_6||plan_dtl_msg_p_7||plan_dtl_msg_p_8||plan_dtl_msg_p_9||plan_dtl_msg_p_10
         ||plan_dtl_msg_p_11||plan_dtl_msg_p_12||plan_dtl_msg_p_13||plan_dtl_msg_p_14||plan_dtl_msg_p_15
         ||summary_p||cmplmntry_sign_msg_p);
         utl_smtp.quit( conn );
    exception
         when others then
         null;
    END;

    did u encounter any error?
    Be more clear in ur saying. As i understood that - is when coming to 5th parameter u r not able to access it. Is it right?
    Message was edited by:
    USER_X

  • How to SEND HTML formatted mail??

    How do I put HTML formatted text into an email I want to SEND? -- "Paste as HTML" in edit menu is dimmed, and I can't get it to un-dim... I want to paste formatted text from an HTML editor into an email... can I do this with Mail, or do I need some other app to do this?

    AHHHH
    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.

  • Word 2010 Send As Attachment does not send a HTML formatted mail

    Hi!
    I'm using Word 2010 to send a document by clicking File->Save & Send->Send Using E-mail->Send as Attachment.
    In the Outlook 2010  new message window I click the ribbon tab Format Text and then I select HTML as the message format.
    I continue to happily compose the HTML body and send it. On the recipient side (also Outlook 2010) the message body comes in Plain text format even tough the source email in the Sent folder is in HTML format.
    Is this a bug or am I missing something obvious?

    Hi,
    It's not a bug as I can tell, the recipient may have configured Outlook to Read all standard mail in plain text, please let the recipient check the following setting:
    Start Outlook 2010.
    Click the File tab in the Ribbon, and then click Options on the menu.
    Click Trust Center on the Options menu.
    Click the Trust Center Settings tab.
    Click E-mail Security.
    Under Read as Plain Text, check if the check box of Read all standard mail in plain text has been selected, untick it and click
    OK to save the setting.
    Send the email again to test, hopefully the recipient can receive the email as the original format.
    Good luck.
    Regards,
    Melon Chen
    TechNet Community Support

  • Margin errors in HTML e-mail test

    In a previous post, I had asked for help viewing HTML mail campaign pieces and got the suggestion to try Email on Acid. I did and this was a scream to watch. The results for Outlook (every issue) was less than stellar. However, Gmail reveled the worst results. I use OS X Mail and everything looks great there. The test spits out critical errors. One is that Photoshop doesn't supply a <!DOCTYPE> declaration, but that's easy enough to fix. The consistent errors in Outlook were:
    MARGINHEIGHT- MARGINHEIGHT attribute is not supported in BODY tags
    Line: 7
    and
    MARGINWIDTH - MARGINWIDTH attribute is not supported in BODY tags
    Line:7
    Any ideas what this is and how to fix?
    http://doncamacho.com/dyk_assets/DYK-2012-Template.htmlhttp://
    Thanks,
    Bill Rzasa

    Short answer.  Don't use Photoshop or any graphics app to generate HTML code for you. 
    The code Photoshop generates is deprecated.  Change the following
         <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    To this:
         <body>
    Use graphics apps for images only.  Use an HTML editor to create your HTML Emails. 
    FYI: For security reasons, many web mail users don't see graphics.  When I look at your HTML Email without images, I see nothing because there is no real text on the page.
    HTML E-mails, What you need to know.
    http://alt-web.com/Articles/HTML-Emails.shtml
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/

  • 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

  • Accessing URL of links in HTML e-mail message via Services

    I'm trying to write a simple service (in Automator) so that when I right-click on a URL, I can send that URL directly to my Instapaper account (rather than opening the link in a browser, and then clicking my bookmarklet to save to Instapaper.)  I have it working for bare URLs included in the text, but I'd like to also be able to do it for hyperlinks in HTML-formatted Mail messages.  Is there a way in Automator to access the underlying URL for a link, rather than the displayed link text?  Clearly some of the built-in items in Mail's context menu (e.g. Open Link, Copy Link) do that, but I can't see how to get access to the URL in Automator.
    Thanks in advance for your help with this,
    Eric

    Hi Scott,
    "Unapealing" it is, but that doesn't get it very high on the long requirements list.
    To make it more appealing to reward points is higher up there and I think everyone would love to see that.
    Nevertheless I added it to the list.
    Best, Mark.
    P.S. On one hand I don't care about points, on the other I get teased in the office when I am not in the top ten, although with all this great contributions from you guys and girls, I am letting go of that goal. So don't bother.
    Message was edited by: Mark Finnern

  • Email html formatted (Text) printing quality issue on hp 6500a (710a)

    I experience some quality problems printing html formatted mails (not attachments, only standard text). The characters are printed with different free space between every char. There is no special sign or format. It happens from different note/netbooks/iphone.
    Pure email-Text-Printing is ok (same text), Attachment-Printing (word-doc arial text only) is ok (same text).
    The  printer has the actual firmware, alle computers and iphone are uptodate. Reset is no solution. Problems are reproducable on other hp 6500 series printers.
    See attached example

    kaaemm,
    Unfortunately, HTML formatted emails are not currently supported. They may go through and print, but results will vary. Only HTML attachments are supported at this time.
    ============================
    If I have solved your issue, please feel free to provide kudos and make sure you mark this thread as solution provided!
    Although I work for HP, my posts and replies are my own opinion and not those of HP.

  • UTL_MAIL: ORA-29279..... 501 badly formatted MAIL FROM user - no " "

    Hi guys,
    I’m trying to redesign a current process that requires a large amount of manual intervention. As such I’d like to utilise UTL_MAIL to send notifications of system events but have been unable to get it to execute on my dev database (installed on my local PC).
    O/S ver:
    Windows XP SP3
    Oracle ver:
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    I’ve configured the smtp_out_server parameter:
    SQL> sho parameter smtp_out_server;
    NAME                                 TYPE        VALUE
    smtp_out_server                  string        XXX.XXX.XXX.80:25
    And installed the required Oracle built in packages:
    SQL> @C:\oracle_builtins\utlmail.sql
    Package created.
    Synonym created.
    SQL> @C:\oracle_builtins\prvtmail.plb
    Package body created.
    No errors.
    I’ve compiled a simple test version of the code:
    CREATE OR REPLACE PROCEDURE test_email IS
    BEGIN
    UTL_MAIL.send(sender     => '[email protected]',
    recipients => '[email protected]',
    subject    => 'UTL_MAIL test subject',
    message    => 'UTL_MAIL test body');
    END;
    +/+
    SQL> @C:\procs\email_proc.sql
    Procedure created.
    However when I execute it I get the attached error(s):
    SQL> execute test_email ;
    BEGIN test_email ; END;
    *+
    ERROR at line 1:
    ORA-29279: SMTP permanent error: 501 badly formatted MAIL FROM user - no <
    ORA-06512: at "SYS.UTL_SMTP", line 21
    ORA-06512: at "SYS.UTL_SMTP", line 99
    ORA-06512: at "SYS.UTL_SMTP", line 222
    ORA-06512: at "SYS.UTL_MAIL", line 397
    ORA-06512: at "SYS.UTL_MAIL", line 608
    ORA-06512: at "SYS.TEST_EMAIL", line 3
    ORA-06512: at line 1
    I’ve also confirmed with our mail team that the sender is included in our firewall config and should not be being blocked……
    Any ideas? Does the package produce any log files / alerts that I could check or is it possible to execute in a verbose mode so I can debug?
    Thanks,
    Chris

    Welcome to the forum.
    That error comes from your SMTP server, and it indicates there's something wrong with the email address.
    You could try the following and see if that works:
    CREATE OR REPLACE PROCEDURE test_email
    IS
    BEGIN
      UTL_MAIL.send(sender => 'test <[email protected]>',
                    recipients => '[email protected]',
                    subject => 'UTL_MAIL test subject',
                    message => 'UTL_MAIL test body'
    END;
    /Some more inputs can be read here: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
    Also, when you want post formatted examples, just use the {noformat}{noformat} tag before and after your examples.
    So, when you type:
    {noformat}select *
    from dual;{noformat}
    it will appear as:select *
    from dual;when you post it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • 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.

  • Trying to send SmartForm in HTML format - error

    Hello
    I am having some trouble when i try to send a smart form in a html format to some e-mail recipients. I have written an program in ABAP that does the extraction of smartform contents and translates in HTML (+CSS) format, ready to be send. I got the program here
    /people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp
    and modified it just a little bit - no major changes.
    I guess the problem is in a service that is not running on the system but i don't know which is that and even where to look for that. I also explained my problem to my BC group but they don't seem to have any ideas .
    I checked the system info (which comp. version we are running):
    Comp. version: CRM 5.0
    Detailed view:
    SAP_ABA         700             0006
    SAP_BASI    700             0006
    PI_BASI     2005_1_700     0006
    ST-PI         2005_1_700     0001
    SAP_BW         700             0006
    SAP_AP         700             0003
    BBPCRM         500             0003
    I have this program properly WORKING on our other system.
    Info:
    Comp. version: BBPCRM 4.0
    Detailed view:
    SAP_BASIS     620     0046
    SAP_ABA             620     0046
    BBPCRM             400     0007
    PI_BASIS     2004_1_620     0009
    ST-PI             2005_1_620     0003
    ST-A/PI             01G_CRM400     0000
    I get the error below. Thanks for all your answers in advance!
    error -
    Service cannot be reached
    What has happened?
    URL http://localhost/SAP/BC/BSP/SAP/SMART_FORMS/DEFAULT.CSS call was terminated because the corresponding service is not available.
    Note
    The termination occurred in system TC1 with error code 403 and for the reason Forbidden.
    The selected virtual host was 0 .
    What can I do?
    Please select a valid URL.
    If you do not yet have a user ID, contact your system administrator.
    ErrorCode:ICF-NF-http-c:005-u:UPUKOLBL-l:5-i:peca_TC1_48-v:0-s:403-r:Forbidden
    HTTP 403 - Forbidden
    Your SAP Internet Communication Framework Team
    .ZETEDNIKSTYLE div#N1.par{ font-family : "Arial" ; font-size : 30pt ; font-weight : bold ; line-height : 4.23mm ; text-decoration : none ; text-align : left ; clear : both ;}.ZETEDNIKSTYLE div#N2.par{ font-family : "Arial" ; font-size : 30pt ; font-weight : bold ; line-height : 4.23mm ; text-decoration : none ; text-align : left ; color : #000000 ; clear : both ;}.ZETEDNIKSTYLE div#P1.par{ font-family : "Arial" ; font-size : 11pt ; font-weight : normal ; line-height : 4.23mm ; text-decoration : none ; text-align : left ; color : #000000 ; clear : both ;}.ZETEDNIKSTYLE div#P2.par{ font-family : "Arial" ; font-size : 12pt ; font-weight : normal ; line-height : 4.23mm ; text-decoration : underline ; text-align : left ; color : #0000FF ; clear : both ;}.ZETEDNIKSTYLE a#FIRST-001.page@media screen {#WINBACKGROUND.win{ overflow : hidden ;}}@media print {#WINBACKGROUND.win{ overflow : hidden ;}}#FIRST-001.page #WINBACKGROUND.win@media screen {#WINBODYTEXT.win{ overflow : auto ;}}@media print {#WINBODYTEXT.win{ overflow : hidden ;}}#FIRST-001.page #WINBODYTEXT.win@media screen {#WINLOGO.win{ overflow : hidden ;}}@media print {#WINLOGO.win{ overflow : hidden ;}}#FIRST-001.page #WINLOGO.win

    I have the same problem even the service in SICF is active. Is it something to do with the default.css url which pointing to localhost? http://localhost/SAP/BC/BSP/SAP/SMART_FORMS/DEFAULT.CSS
    Pls help.

  • Information Broadcasting - Creation - Error in HTML / MHTML format

    Hi gurus,
    I'm trying to create a Broadcasting for a query with HTML format. All the steps, including the scheduling, were succesfully. But when I click on Execute button, I got the following error message:
    The following error text was processed in the system WD4 : The current application triggered a termination with a short dump.
    The error occurred on the application server bp1tulap098_WD4_00 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Form: INTERNAL_ERROR of program SAPLSDCL
    Form: PHIO_GET_CONTENT_ACCESS of program SAPLSDCI
    Function: SDOK_PHIO_GET_CONTENT_ACCESS of program SAPLSDCI
    Function: SKWF_PHIO_CONTENT_ACCESS_GET of program SAPLSKWF_CONTENT
    Method: COPY_MIME_TO_FOLDER of program CL_RSRA_KWF_UTILITIES=========CP
    Method: GET_STYLESHEET of program CL_RSRA_KWF_TMPL==============CP
    Method: CONSTRUCTOR of program CL_RSRA_KWF_TMPL==============CP
    Method: SET_TEMPLATE_FOLDER of program CL_RSRA_ENGINE_BC=============CP
    Method: CONSTRUCTOR of program CL_RSRA_ENGINE_BC=============CP
    Method: EXECUTE_SINGLE of program CL_RSRA_JOB===================CP 
    I've tried to create it for all the queries, but the same error occurred. I researched here and in the SAP notes but I found nothing about it. Anyone could help me?
    Thanks!!!
    Helder

    Hi Helder,
    Can you please let me know wether if you have found a solution for  this problem....
    Bcoz  i am also facing the similar one now...
    please post the solution if you can...
    or GURU'S some help please......................
    Thanks in Adv
    Dev

  • 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

Maybe you are looking for

  • Is there a NAS box that works well with OSX

    I've always struggled with NAS boxes & OSX.  Sure, I can connect them up, and copy files to and from a mac, but eventually I always seem to run into issues.  Suddenly I can no longer access the files, or I can no longer connect at all, or it fails to

  • Setting Environment variable in windows xp

    Hi all, I am trying to run a java program in textpad, which is installed in windows XP, but i am getting the following error. java.lang.NoSuchMethodError: main Exception in thread "main" Can anybody tell me, how to set the environment variable in the

  • Implement a Pop-Up LOV in a report.

    Hi, I would like to use the 'HTMLDB_ITEM' item to generate a textfield with a link to a Pop-Up LOV in an Apex report. Anyone ever tried that before? Thanks. Edited by: Jacky411 on Jan 14, 2009 2:49 PM

  • Initialization for char data type?

    I observed that as String I can declare something like this: String str = ""; but for char data type, if I declare: char ch = ''; the compiler will have an error: "empty character literal". So how can I fixe this problem when I want to initialize my

  • Friend's iPhone is disabled and asks me to connect to iTunes, however, the home button and Power button are broke...

    As the title says, it needs the passcode. [https://pbs.twimg.com/media/BOrZpfZCIAAguGD.jpg] <--- iPhone However, she doesn't know the passcode... I have Googled for answers but they all say "use the home and wake button", but, they're broke. There ar