asp classic - Specify my own message-id header when sending email with cdo.message -
this question has answer here:
- add header email vb asp 3.0 script 2 answers
is there way specifty own message-id cdo ?
using following configuration, message-id still generated cdo component , ignores 1 specified.
<% const cdosendusingport = 2 dim imsg, iconf, flds set imsg = createobject("cdo.message") set iconf = createobject("cdo.configuration") set flds = iconf.fields ' set cdosys configuration fields use port 25 on smtp server flds .item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdosendusingport .item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp@example.com" .item("urn:schemas:mailheader:message-id") = "0123456789.0123456789@example.com" .update end imsg set .configuration = iconf .from = "from@example.com" .subject = "test" .to = "to@example.com" .htmlbody = "test" .send end set imsg = nothing set iconf = nothing set flds = nothing %>
the configuration object iconf
irrelevant message object imsg
, don't need create it.
so, remove set iconf = createobject("cdo.configuration")
, replace set flds = iconf.fields
set flds = imsg.fields
.
you need use imsg.fields
set headers message.
dim imsg, iconf, flds set imsg = createobject("cdo.message") set flds = imsg.fields set iconf = createobject("cdo.configuration") set flds = iconf.fields ' set cdosys configuration fields use port 25 on smtp server flds .item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdosendusingport .item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.example.com" .update end imsg.fields .item("urn:schemas:mailheader:message-id") = "0123456789.0123456789@example.com" .update end imsg set .configuration = iconf .from = "from@example.com" .subject = "test" .to = "to@example.com" .htmlbody = "test" .send end
Comments
Post a Comment