Solved

add custom headers to my mail

Posted on 2016-08-02
2
47 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
2 Comments
 
LVL 32

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Scraping specific data within an XML document 19 54
Sending Attachment via CDO 3 58
Extract field headers and values between quotes 12 43
Problem to With line 4 39
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

912 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now