By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,843 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,843 IT Pros & Developers. It's quick & easy.

Extra mail header with CDO from .asp side - how to do this

P: n/a
I have the below function witch I use to send mail to reciptents on my
maillist from an .asp side
I am about to make a bounce back system - and would therefore like to
make one extra MailHeader witch my bounce back system can take out -
But I have no luck with adding the extra header

-----------------------------------------
Sub sendmail

'Dimension variables
Dim objCDOSYSCon, objCDOSYSMail

'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "localhost"
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

' Here I would like to include a extra header with the userID value -
but the below code donīt work.

'
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/mailheader:UserID")
= UserIDValue

objCDOSYSCon.Fields.Update

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = from
objCDOSYSMail.To = email
objCDOSYSMail.cc = emailcc
objCDOSYSMail.bcc = emailbcc
objCDOSYSMail.ReplyTo = ReplyTo

objCDOSYSMail.Subject = Subject

objCDOSYSMail.HTMLBody = Txt

objCDOSYSMail.Send

'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing

End Sub

Oct 15 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
>>>>>>>>>>>>>>>>>>
"majlandt" <ma******@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
I have the below function witch I use to send mail to reciptents on my
maillist from an .asp side
I am about to make a bounce back system - and would therefore like to
make one extra MailHeader witch my bounce back system can take out -
But I have no luck with adding the extra header

-----------------------------------------
Sub sendmail

'Dimension variables
Dim objCDOSYSCon, objCDOSYSMail

'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserv
er")
= "localhost"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserv
erport")
= 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusin
g")
= 2
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconn
ectiontimeout")
= 60

' Here I would like to include a extra header with the userID value -
but the below code donīt work.

'
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/mailhead
er:UserID")
= UserIDValue

objCDOSYSCon.Fields.Update

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = from
objCDOSYSMail.To = email
objCDOSYSMail.cc = emailcc
objCDOSYSMail.bcc = emailbcc
objCDOSYSMail.ReplyTo = ReplyTo

objCDOSYSMail.Subject = Subject

objCDOSYSMail.HTMLBody = Txt

objCDOSYSMail.Send

'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing

End Sub
<<<<<<<<<<<<<<<<<<<<<

First don't try adding headers to the configuration object. Add them to the
message object fields collection.
Second always prefix your custom headers with 'x-' to avoid aliasing with
any other SMTP header and it's probably best to use an additional prefix is
you are using a common concept like userID.

E.G., x-mycompany-userid


Oct 15 '06 #2

P: n/a

Anthony Jones wrote:
>>>>>>>>>>>>>>>>>
"majlandt" <ma******@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
I have the below function witch I use to send mail to reciptents on my
maillist from an .asp side
I am about to make a bounce back system - and would therefore like to
make one extra MailHeader witch my bounce back system can take out -
But I have no luck with adding the extra header

-----------------------------------------
Sub sendmail

'Dimension variables
Dim objCDOSYSCon, objCDOSYSMail

'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserv
er")
= "localhost"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserv
erport")
= 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusin
g")
= 2
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconn
ectiontimeout")
= 60

' Here I would like to include a extra header with the userID value -
but the below code donīt work.

'
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/mailhead
er:UserID")
= UserIDValue

objCDOSYSCon.Fields.Update

'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = from
objCDOSYSMail.To = email
objCDOSYSMail.cc = emailcc
objCDOSYSMail.bcc = emailbcc
objCDOSYSMail.ReplyTo = ReplyTo

objCDOSYSMail.Subject = Subject

objCDOSYSMail.HTMLBody = Txt

objCDOSYSMail.Send

'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing

End Sub
<<<<<<<<<<<<<<<<<<<<<

First don't try adding headers to the configuration object. Add them to the
message object fields collection.
Second always prefix your custom headers with 'x-' to avoid aliasing with
any other SMTP header and it's probably best to use an additional prefix is
you are using a common concept like userID.

E.G., x-mycompany-userid
ok, but how do I do that then
I dont know where to do that or how to do it

Oct 15 '06 #3

P: n/a
>
>First don't try adding headers to the configuration object. Add them to
the
>message object fields collection.
Second always prefix your custom headers with 'x-' to avoid aliasing
with
>any other SMTP header and it's probably best to use an additional prefix
is
>you are using a common concept like userID.

E.G., x-mycompany-userid

ok, but how do I do that then
I dont know where to do that or how to do it
You were pretty close:-

objCDOSYSMail.Fields("urn:schemas:mailheader:x-mycompany-userid") =
UserIDValue
objCDOSYSMail.Fields.Update

Oct 17 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.