Java Mail header info displayed in email results

I am having problems with the output generated by the send() method in javamail. The out contains unwanted email header info within the email. Please review code and email output. The Cc: thru Content-Transfer-Encoding should not display
-Thanks....
Greg
Code :
+++++
Session session2 = null;
Properties props = new Properties();
if (ConfigInfo.getBatchJob() == false) {                       
     InitialContext ic = new InitialContext();
     Session session = (Session) ic.lookup("myMailSession");
     props.put("mail.from", fromAddress);
     session2 = Session.getInstance(props);
} else // email from batch job
     props.put("mail.store.protocol", "pop3");
     props.put("mail.transport.protocol", "smtp");
     props.put("mail.host", ConfigInfo.getMailHost());
     props.put("mail.smtp.host", ConfigInfo.getMailHost());
     props.put("mail.from", fromAddress);
     session2 = Session.getInstance(props);
Message msg = new MimeMessage(session2);
msg.setFrom();
msg.setRecipients(Message.RecipientType.TO, InternetAddress
          .parse(toEmailAddress, false));
msg.setRecipients(Message.RecipientType.CC, InternetAddress
          .parse(copyEmail, false));
msg.setRecipient(Message.RecipientType.CC, new InternetAddress(
          copyEmail));
msg.setSubject(subject);
msg.setSentDate(sentDate);
msg.setContent(content, "text/plain");
Transport.send(msg);
Output:
+++++
....... Unwanted email header info <<<<<<<<<<
Cc: [email protected]
Mime-Vesrion 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
----

Hi,
Thanks for the info.
The Extra Text is not to be seen now. That’s good. But I have another issue now. The email skips new lines.
If I have a new line in between the two blocks , the email skips the new line.
e.g. If I had to sent the following data:
"Line1
Line2"
It appears as "Line1 Line2" in the end. The new line is skippeed.
Appreciate if someone can tell me the reason/solution.
Regards,
ParagJ

Similar Messages

  • Mail doesn't display full email text, only displays the subject line

    Mail doesn't display full email text, only displays the subject line.
    My preview shows first three lines of email, but when I chose the email specifically mail doesn't display any lines of text.  Been this way for about ten days.  Please help.  Ben

    Awesome.  Rebooting the phone worked.  I had never turned the phone off before (for the next guy - you hold down the "sleep" button for longer than you'd think and that'll do a full shutdown).  thank you for your help.

  • Mac Mail header info gone

    How do you put the header info back? Sender, Subject, Attachment save option etc are suddenly missing from incoming email.
    The email just displays the letter portion only.

    Open up the Mail preferences. Go to the "Viewing" section. There is a dropdown listbox for Header Details. You can set that back to default.

  • Mail Header in Reply/Forwarded Email

    In Mail, is it possible to show the full header (from, date, subject, to) rather than an abbreviated quote in replies and forwarded email?

    exactly so.
    in general, for any configutil setting:
    0=off=no
    1=yes=on

  • IMail: How can I set mail preferences to display actual email address and not short names.

    Even though I have it correctly set in Preferences , i.e. "Use Smart Addresses" is unchecked, the addressee automatically changes to the person's name rather than the email address.   I am unable to find a way to display the actual email address option on iMail (Yosemite)  I do not want nicknames/short names but want the actual email address to display on my address line.   Can anyone advise please?

    Thanks, Ernie
    I wasted about 20 minutes looking for it and couldn't find it
    cheers,
    tom

  • Why does all the header info of an email get printed when I print out an email?

    Even when I print a short email, nearly a whole page is taken up with unwanted "header" information eg X-mailSG and several lines ogf gobblygook.?

    View menu (alt+V) > headers > normal.

  • Java Mail: send a SINGLE email to a distribution list

    Is it possible to send a single email to a distribution list using Java Mail?
    Please help with some code samples.
    Right now, our mail program uses java mail api to send one email/person in the distribution list and runs in a for loop. Is it possible to have the distribution list in the to field and just send one single email to all persons in the list?
    Thanks,
    Jayashree.

    Yes, of course, assuming your mail server supports
    distribution lists. Most mail servers do, but exactly
    how you create and administer a mailing list varies
    from server to server.
    Once you've created the mailing list on the server,
    just use the name of the list in the To field of the
    message.

  • Java.lang.UnsupportedClassVersionError while using java mail api

    Hi Everybody ,
    I am new comer to this forum , and would like to be an active member.
    I am getting this error while trying to use the java mail api to send an email using smtp.
    The error is as follows :
    Exception in thread "main" java.lang.UnsupportedClassVersionError: javax/mail/Message (Unsupported major.minor version 48.0)
    Can Anyone please tell where I am wrong.
    I am using the following code
    ==============================================================
    Properties props = new Properties();
    props.put("mail.smtp.host", "smtp.abc.com");
    // create some properties and get the default Session
    Session session = Session.getDefaultInstance(props, null);
    session.setDebug(debug);
    // create a message
    Message msg = new MimeMessage(session);
    // set the from and to address
    InternetAddress addressFrom = new InternetAddress(from);
    msg.setFrom(addressFrom);
    InternetAddress[] addressTo = new InternetAddress[recipients.length];
    for (int i = 0; i < recipients.length; i++)
    addressTo[i] = new InternetAddress(recipients);
    msg.setRecipients(Message.RecipientType.TO, addressTo);
    // Optional : You can also set your custom headers in the Email if you Want
    msg.addHeader("MyHeaderName", "myHeaderValue");
    // Setting the Subject and Content Type
    msg.setSubject(subject);
    msg.setContent(message, "text/plain");
    Transport.send(msg);
    ==============================================================

    Hi Philip ,
    Thanks for the prompt reply , I had installed oracle client services which overid my jdk1.4 installation with jdk1.3 and hence the error. I changed my classpath settings to point to jdk1.4 and it owrked properly.
    Thanks once again.
    regards,
    Rupesh Rajan

  • Oracle Java Mail API exception in Jdev 11.1.15

    we are using java mail api to send out emails. and wrap it in java embedding with in our webservice.
    we are using jdeveloper 11.1.1.5 for this and the Java API is failing with the below error, we have included all the java libraries. As code is working fine in Jdeveloper 11.1.2
    we tried different version of jdeveloper ( 11.1.1.5, 11.1.1.7 ) but its still the same. Can some one please suggest
    Exception in thread "main" java.lang.RuntimeException: javax.mail.MessagingException: Can't send command to SMTP host;
      nested exception is:
        javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at bts.mail.SendMailTLS.main(SendMailTLS.java:50)
    Caused by: javax.mail.MessagingException: Can't send command to SMTP host;
      nested exception is:
        javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1420)
        at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:1408)
        at com.sun.mail.smtp.SMTPTransport.ehlo(SMTPTransport.java:847)
        at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:384)
        at javax.mail.Service.connect(Service.java:297)
        at javax.mail.Service.connect(Service.java:156)
        at javax.mail.Service.connect(Service.java:105)
        at javax.mail.Transport.send0(Transport.java:168)
        at javax.mail.Transport.send(Transport.java:98)
        at bts.mail.SendMailTLS.main(SendMailTLS.java:45)

    Can Some body help me with this please

  • Exception in java mail API when parsing email

    I am receiving the following exception when receiving some emails that contain attachments with java mail (irrelevant part of stack trace omitted):
    javax.mail.internet.ParseException: Expected ';', got ","
         at javax.mail.internet.ParameterList.<init>(ParameterList.java:289)
         at javax.mail.internet.ContentDisposition.<init>(ContentDisposition.java:100)
         at javax.mail.internet.MimeBodyPart.getFileName(MimeBodyPart.java:1136)
    The header of a message the causes the problem is:
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) ------------ Message headers ------------
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Received: from mail2.uscourts.gov ([10.170.250.2])
    by ushub06.uscmail.dcn (Lotus Domino Release 8.5.2FP1 HF3)
    with SMTP id 2011042514392620-733724 ;
    Mon, 25 Apr 2011 14:39:26 -0400
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Received: from (unknown [63.174.91.123]) by avms-usc-04c-02vh.ibmta.uscourts.gov with smtp
         id 191c_067d_57fad3b8_6f6b_11e0_8de9_00265519f638;
         Mon, 25 Apr 2011 18:39:24 +0000
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) X-WSS-ID: 0LK815L-05-67D-02
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) X-M-MSG:
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Received: from kcmexclaim.Our-Firm.com (unknown [10.42.5.222])by mail4.stinson.com (Axway MailGate 3.8.1) with ESMTP id 27239A12C1D;     Mon, 25 Apr 2011 13:39:20 -0500 (CDT)
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Received: from KCME2K7-HUB02.Our-Firm.com ([10.42.5.19]) by kcmexclaim.Our-Firm.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 25 Apr 2011 13:39:23 -0500
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Received: from FIRMCMS01.Our-Firm.com ([fe80::81d0:dd2b:9983:1126]) by KCME2K7-HUB02.Our-Firm.com ([::1]) with mapi; Mon, 25 Apr 2011 13:39:22 -0500
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) From:
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) To:
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Cc:
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Disposition-Notification-To:
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Date: Mon, 25 Apr 2011 13:39:21 -0500
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Subject: Order Regarding Application To Employ SMH as Debtor's Counsel
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Thread-Topic: Order Regarding Application To Employ SMH as Debtor's Counsel
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Thread-Index: AcwDb/bpRQlxt/eTQC6BA7G10hdWJQAB99vQ
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Message-ID: <[email protected]>
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Accept-Language: en-US
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) X-MS-Has-Attach: yes
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) X-MS-TNEF-Correlator:
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) acceptlanguage: en-US
    2011-04-25 14:39:48,060 INFO [STDOUT] (WorkManager(2)-97) Importance: Normal
    2011-04-25 14:39:48,061 INFO [STDOUT] (WorkManager(2)-97) Priority: normal
    2011-04-25 14:39:48,061 INFO [STDOUT] (WorkManager(2)-97) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4841
    2011-04-25 14:39:48,061 INFO [STDOUT] (WorkManager(2)-97) MIME-Version: 1.0
    2011-04-25 14:39:48,061 INFO [STDOUT] (WorkManager(2)-97) Return-Path:
    2011-04-25 14:39:48,061 INFO [STDOUT] (WorkManager(2)-97) X-OriginalArrivalTime: 25 Apr 2011 18:39:23.0526 (UTC) FILETIME=[18E10260:01CC0378]
    2011-04-25 14:39:48,061 INFO [STDOUT] (WorkManager(2)-97) X-MIMETrack: Itemize by SMTP Server on USHUB06/H/US/USCOURTS(Release 8.5.2FP1 HF3|December 21, 2010) at 04/25/2011 02:39:26 PM, Serialize by POP3 Server(Release 8.0.2FP3 HF28|December 28, 2009) at 04/25/2011 02:39:47 PM
    2011-04-25 14:39:48,061 INFO [STDOUT] (WorkManager(2)-97) Content-Transfer-Encoding: 7bit
    2011-04-25 14:39:48,061 INFO [STDOUT] (WorkManager(2)-97) Content-Class: urn:content-classes:message 2011-04-25 14:39:48,061 INFO [STDOUT] (WorkManager(2)-97) Content-Type: multipart/mixed;     boundary="_004_52835C1F7A6C8D4F989C433DCC611CA06F252D6682FIRMCMS01OurF_"
    2011-04-25 14:39:48,061 INFO [STDOUT] (WorkManager(2)-97) Content-Language: en-US
    the client/OS combination of the mail sender is Windows XP service Pack 3/Outlook 2007 , Java Mail version 1.4.3
    Any help would be appreciated
    Edited by: 854778 on Apr 26, 2011 8:28 AM

    The exception is occurring when parsing the Content-Disposition header.
    I don't see that header in the list of headers you provided.
    Can you save the entire message to a text file using
    msg.writeTo(new FileOutputStream("msg.txt"));
    Then look for the Content-Disposition header in msg.txt. Most likely you'll
    find that it is incorrectly formatted - as the exception says, there's a comma
    in a place that a semicolon is expected.

  • Displayed Header Info Prints Differently

    The header info. that's displayed on-screen, is different than what gets printed. How do that happen?
    Specifically, the displayed header info. shows; "To: My Name" but when printed that same line is changed to; "To: my email address".
    I need the header and email to print the exact way it is displayed. How do I get Mail to accomplish this simple task?
    Thanks,
    PS - Apologies for the rude screen name. I got frustrated with the account creation hassle.

    Greetings,
    When printing email, the displayed name (or Smart Address if you have that enabled) will always show the name and/or the email address of the person it's To: and From:; there's no way around that.

  • TS3899 I can preview email when it arrives (I chose 5 lines) but when I then go to open up the full email, I see only the header info (To, Subject & Date); nothing in the body...it is blank.  This only started recently as before, it worked as expected. He

    I can preview email when it arrives (I chose 5 lines) but when I then go to open up the full email, I see only the header info (To, Subject & Date); nothing in the body...it is blank.  This only started recently as before, it worked as expected. Help?

    I have two yahoo accounts and I know as they 'improved' their servers I had periodic outages. It'd work fine on my webmail on  my computer, webmail on the iPad, but not via the mail app. And it was stuff on their end. It may be a case of wait and see and you may need to eventually remove/readd the account on your iPhone.
    When the issue is on their end, unfortunately there's not much for users to do beyond wait it out or find work arounds.

  • Background Job result output should be displayed in Email body

    Hi Friends,
    One of our user is scheduling background job, He need the output to his external Email ID.
    user required that Job result output should be displayed in Email body, Not in attachment.
    We have tried but job result received in email as HTML (or) PDF file attachment, But he wants output  in Email body itself.
    Please help.
    Regards,
    Karthickbabu G.G

    Hi,
    Displaying report output in email body is not available as a standard feature. Also doing a custom development would be very cumbersome .
    Regards,
    Deepak Kori

  • I have a problem with mail autofilling info email addresses. Emails sent to me the from looks like this: Holiday in the United States email address . I have no idea what this Holiday in the United States is...How can I fix/change to my name?

    I have an irritating problem with mail autofilling info in email addresses. Emails sent to me the from looks like this: Holiday in the United States <my email address>. I have no idea what this Holiday in the United States is or how it got to be there...How can I fix/change to my name?
    I fixed the To: autofilling incorrectly by deleting my email address from the Previous Recipients List, but is there a way to stop that from coming up on emails that I receive?

    Have you checked your Mac address book? If your email is saved somewhere in your address book with the name "Holidays in the United States" it might be adding the name automatically in Mac Mail.
    Alternatively, try this:
    Delete an Email Address from Auto-Complete in Mac OS X Mail
    To remove an email address from the auto-complete list in Mac OS X Mail:
    Start typing the recipient's address or name in a new message.
    Select the desired address from the auto-complete list as if you'd compose an email to them.
    Click the small down arrow in the recipient.
    Select Remove from Previous Recipients List from the menu.
    You can also search for the unwanted address directly in the previous recipients list:
    Select Window | Previous Recipients from the menu in Mac OS X Mail.
    Highlight the address you want to remove.You can highlight multiple addresses by holding down the Command key.
    Click Remove from List.
    Source: About.com

  • Mouse Over Info displays immediately at Finder, Mail, Cyberduck etc.

    Hi, I have a new Problem with my Mac -
    At Finder, Mail, Cyberduck the yellow Info displays by Mouse Over displays immediately while using the Cursor.
    Normaly the Infos about a Folder or File appear a few seconds after the mouse is still on it - but in my case it appearing directly.
    Can somebody help ?
    THX
    Henning

    Hi
    since it's several apps - try the tip at http://hints.macworld.com/article.php?story=20061107125819464 or at least a
    defaults read -g NSInitialToolTipDelay
    to see if that's the cause
    Is a New User Account the same ?

Maybe you are looking for