Solved

add custom headers to my mail

Posted on 2016-08-02
2
41 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
Comment Utility
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
Comment Utility
Thank you!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

11 Experts available now in Live!

Get 1:1 Help Now