Setting message priority with CDOSYS

P

Peter Croft

Hello. Can someone please tell me how to set the priority of an email
message
sent from an ASP script using CDOSYS as below -

set oCdoMsg = server.createobject("CDO.Message")
oCdoMsg.from=...
oCdoMsg.to=...
oCdoMsg.subject=...
oCdoMsg.importance=1 ' fails
oCdoMsg.HTMLBody=....
oCdoMsg.send

With CDONTS I successfully used .importance but that fails with CDOSYS.
I have searched the MSDN documentation but can't find it. BTW I find the
various alternatives
confusing - CDO, CDONTS, CDOEX etc.
Thanks in advance for any help.
Peter Croft
 
P

Peter Croft

That doesn't work. It doesn't raise an error but neither does it change the
priority.
The documentation (if I'm looking in the right place) says Fields is
read-only.

Thanks,
Peter
 
A

Aaron [SQL Server MVP]

I can't get these to work either, even when I set importance to high and
priority to urgent, the header comes in with both stating normal. I think
it might depend on the SMTP server, whether it preserves the values or
ignores them. Here is the code I used (I tried setting the imp/pri on both
config and message):

<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library"
-->
<%
Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "<mail server>"
.Item(cdoPriority) = cdoPriorityUrgent
.Item(cdoImportance) = cdoHigh
.Update
End With

Set cdoMessage = CreateObject("CDO.Message")

With cdoMessage
Set .Configuration = cdoConfig
.Fields(cdoPriority) = cdoPriorityUrgent
.Fields(cdoImportance) = cdoHigh
.From = "(e-mail address removed)"
.To = "(e-mail address removed)"
.Subject = "Sample CDO Message"
.TextBody = "This is a test for CDO.message"
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>

Header still says:

Importance: normal
Priority: normal

--
http://www.aspfaq.com/
(Reverse address to reply.)
 
R

Rob Collyer

I can't get these to work either, even when I set importance to high
and priority to urgent, the header comes in with both stating normal.
I think it might depend on the SMTP server, whether it preserves the
values or ignores them. Here is the code I used (I tried setting the
imp/pri on both config and message):

<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library"
-->
<%
Set cdoConfig = CreateObject("CDO.Configuration")

With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "<mail server>"
.Item(cdoPriority) = cdoPriorityUrgent
.Item(cdoImportance) = cdoHigh
.Update
End With

Set cdoMessage = CreateObject("CDO.Message")

With cdoMessage
Set .Configuration = cdoConfig
.Fields(cdoPriority) = cdoPriorityUrgent
.Fields(cdoImportance) = cdoHigh
.From = "(e-mail address removed)"
.To = "(e-mail address removed)"
.Subject = "Sample CDO Message"
.TextBody = "This is a test for CDO.message"
.Send
End With

Set cdoMessage = Nothing
Set cdoConfig = Nothing
%>

Header still says:

Importance: normal
Priority: normal

You code looks fine.....

What software is the smtp server running?
 
Y

Yan-Hong Huang[MSFT]

Hi Ten,

I suggested you try Luke's suggestion to set periority.

Another link on this topic:
http://groups.google.com/groups?q=CDO.Message++ASP+priority+email&hl=en&lr=&
ie=UTF-8&selm=6gg13vcuntc5hs35fa8pnc5taqhnj2ef65%404ax.com&rnum=1

Peter, is the problem resolved? Thanks.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
-http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.as
p&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top