Colin Brazier
asked on
CDOSYS email priority
Hi,
I need to set high priority and/or importance in an email sent via CDOSYS/Outlook. This is to stop them being thrown into a Junk folder automatically by Outlook.
I understand the message.fields collection, which contains priority and importance, is read only. Any way of getting round this? An extensive search in EE and web suggests otherwise...
Cheers,
Colin
Here's my code:
set Msg = CreateObject("CDO.Message" )
set Conf = CreateObject("CDO.Configur ation")
Set Flds = Conf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sSMTPServer
.Update
End With
With Msg
Set .Configuration = Conf
.htmlBody = sNewHTMLText
.To = rsSubEmails.Fields("usrema il")
.From = "full.name@xxx.yyy.com"
.Subject = "News"
.AddRelatedBodyPart sFilePath & "\title.gif", "title.gif", cdoRefTypeId
.AddRelatedBodyPart sFilePath & "\subtitle.gif", "subtitle.gif", cdoRefTypeId
.AddRelatedBodyPart sFilePath & "\bplogo.gif", "bplogo.gif", cdoRefTypeId
End With
set Msg=nothing
I need to set high priority and/or importance in an email sent via CDOSYS/Outlook. This is to stop them being thrown into a Junk folder automatically by Outlook.
I understand the message.fields collection, which contains priority and importance, is read only. Any way of getting round this? An extensive search in EE and web suggests otherwise...
Cheers,
Colin
Here's my code:
set Msg = CreateObject("CDO.Message"
set Conf = CreateObject("CDO.Configur
Set Flds = Conf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sSMTPServer
.Update
End With
With Msg
Set .Configuration = Conf
.htmlBody = sNewHTMLText
.To = rsSubEmails.Fields("usrema
.From = "full.name@xxx.yyy.com"
.Subject = "News"
.AddRelatedBodyPart sFilePath & "\title.gif", "title.gif", cdoRefTypeId
.AddRelatedBodyPart sFilePath & "\subtitle.gif", "subtitle.gif", cdoRefTypeId
.AddRelatedBodyPart sFilePath & "\bplogo.gif", "bplogo.gif", cdoRefTypeId
End With
set Msg=nothing
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry for the delay.
Preece, yes I had seen those; at least the first two, I'm not sure how the 3rd one applies to priority?
alorentz,
I have seen that article but I get variable undefined (cdoHigh) so i changed it to 2, then I get
variable undefined (cdoImportance) and the same goes for cdoPriority.
Here's where I got the impression it was read only:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/78bd7f77-47e7-43ef-91fd-54abc7ca6a00.asp
Colin
Preece, yes I had seen those; at least the first two, I'm not sure how the 3rd one applies to priority?
alorentz,
I have seen that article but I get variable undefined (cdoHigh) so i changed it to 2, then I get
variable undefined (cdoImportance) and the same goes for cdoPriority.
Here's where I got the impression it was read only:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/78bd7f77-47e7-43ef-91fd-54abc7ca6a00.asp
Colin
Variable underfined means the constants defined in this code are not available:
<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-8 2DB-00C04F B1625D"
NAME="CDO for Windows 2000 Library"
-->
So, as you have done, you just use the numbers for the constants instead. See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_cdo_cdoimportancevalues_enum.asp
<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-8
NAME="CDO for Windows 2000 Library"
-->
So, as you have done, you just use the numbers for the constants instead. See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_cdo_cdoimportancevalues_enum.asp
ASKER
alorentz,
You are a STAR! and I am not...I totally ignored/missed the CDO library metadata!!
You will get, and deserve, the points, but if you can tell me how to do this as a vbs script I will add some more.
Colin
Have you tried the code above? I haven't tried it in vbs, but should work....replace constant though.
ASKER
alorentz,
Using vbs the script runs without even sending the email. When I comment out the message.fields.item(cdoImp ortance) and (cdoPriority) updates, it sent the email but of course with normal priority. The link suggests using CDONTS, I think I have to use CDOSYS.
Thanks anyway, I've done alot more searching but haven't found anything. Perhaps a q in the VB channel?
Cheers, Colin
Using vbs the script runs without even sending the email. When I comment out the message.fields.item(cdoImp
Thanks anyway, I've done alot more searching but haven't found anything. Perhaps a q in the VB channel?
Cheers, Colin
https://www.experts-exchange.com/questions/20542240/how-to-set-cdo-message-mail-priority-and-Setting-attachment-Name.html
https://www.experts-exchange.com/questions/21273030/CDO-Messaging.html
https://www.experts-exchange.com/questions/21110743/sending-email.html
Preece