gartcimore / javamail4ews

JavaMail for EWS (Exchange Web Service)
GNU Lesser General Public License v3.0
9 stars 7 forks source link

Adding custom headers in email are not seen on mail recieved. #6

Open santosh103 opened 4 years ago

santosh103 commented 4 years ago

Adding custome headers in email are not seen on mail recieved.

gartcimore commented 4 years ago

Do you have a sample of what you are doing and what is wrong ?

santosh103 commented 4 years ago

just add some custom header in the email and send it. Those custom headers are not visible in the mail received. For adding custom header I used - email.addHeaderLine("X_MY_Custom_Header=myValue");

gartcimore commented 4 years ago

Here what I used `

    MimeMessage lMessage = new MimeMessage(session);
    lMessage.setRecipient(Message.RecipientType.TO, new InternetAddress("user@example.org"));
    lMessage.setSubject("Hello World!");
    lMessage.setText("Hello World!");

    lMessage.addHeaderLine("X_MY_Custom_Header=myValue");

    //Send the mail via EWS
    lTransport.sendMessage(lMessage, lMessage.getRecipients(Message.RecipientType.TO));

` And I got it in the email received :

Received: from servername.outlook.com ([xxxx::xxxx:xxxx:xxxx:xxxx]) by servername.outlook.com ([xxxx::xxxx:xxxx:xxxx:xxxx%6]) with mapi id xx.xx.xx.xx; Fri, 2 Oct 2020 17:12:40 +0000
From: Me <me@example.com>
To: "someone else" <someone@example.org>
Subject: Hello World!
Thread-Topic: Hello World!
Thread-Index: BQHWmN87U8U6MtSDlEOF20sUl0xp+B==
Date: Fri, 2 Oct 2020 17:12:40 +0000
Message-ID: <messageId@servername.outlook.com>
Accept-Language: fr-FR, en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x_my_custom_header=myvalue: X_MY_Custom_Header=myValue
x-originating-ip: [xx.xx.xx.xx]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id:

To me this is working as expected