Solved

add custom headers to my mail

Posted on 2016-08-02
2
72 Views
Last Modified: 2016-08-02
I'm trying to add costum headers to my mail. This is my code:

Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

	objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.mydomain.com"
	objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
	objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
	objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
	objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
	objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mailer@mydomain.com"
	objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypass"
	objCDOSYSCon.Fields.Update
	objCDOSYSCon.Fields("urn:schemas:mailheader:X-invitationId") = "1234567"
	objCDOSYSCon.Fields.Update

Set objCDOSYSMail.Configuration = objCDOSYSCon

objCDOSYSMail.BodyPart.Charset = "UTF-8"
objCDOSYSMail.From = """mydomain"" <mailer@mydomain.com>"
objCDOSYSMail.To = "some@email.com"
objCDOSYSMail.Subject = "My Email Subject"
objCDOSYSMail.HTMLBody = "My Email Body" 
objCDOSYSMail.Send

Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing 

Open in new window


When I send it - I see the mail correctly but when I'm checking the headers I don't see the "X-invitationId" header.
Any Ideas?
0
Comment
Question by:arielbf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 33

Accepted Solution

by:
Big Monty earned 500 total points
ID: 41738962
you need to add it to your email object, not the config object:

objCDOSYSMail.Fields("urn:schemas:mailheader:X-invitationId") = "1234567"
objCDOSYSMail.Fields.Update
0
 

Author Closing Comment

by:arielbf
ID: 41739407
Thank you!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question