• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4883
  • Last Modified:

Mark email as High Importance in vbscript

I need a little help with this one..... Could someone give me a little assistance in how to edit the vbscript below to send an email marked as "High Importance".  Thanks in advance.
Set objEmail = CreateObject("CDO.Message")
Set objFSO = CreateObject("Scripting.FileSystemObject") 
 
objEmail.Subject = "Test Mail" 
objEmail.From = "me@mail.com" 
objEmail.To= "you@mail.com"
objEmail.TextBody =  "This is an important email"
objEmail.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
objEmail.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _ 
"smtp.east.cox.net" 
objEmail.Configuration.Fields.Item _ 
 ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
objEmail.Configuration.Fields.Update 
objEmail.Send

Open in new window

0
abgtemp
Asked:
abgtemp
  • 5
  • 3
  • 2
  • +1
2 Solutions
 
sirbountyCommented:
cdoMail.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") = "High" ' For Outlook 2003
cdoMail.Fields.Item("urn:schemas:mailheader:X-Priority") = 2 ' For Outlook 2003 also
cdoMail.Fields.Item("urn:schemas:httpmail:importance") = 2 ' For Outlook Express

ref: http://www.lewisroberts.com/2006/06/09/sending-cdomessage-with-importance/
0
 
abgtempAuthor Commented:
I found that same link, but I wasn't able to get that code to work with my existing code.
0
 
sirbountyCommented:
change cdoMail to objEmail in your code - make sure it's before the objEmail.Configuration.Fields.Update line...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
abgtempAuthor Commented:
Still nothing. Were you able to get it to work on your side?
0
 
sirbountyCommented:
Odd - no, I haven't...tried several different methods - but I use system.mail in .Net for my projects now, so I didn't have many sample scripts to check.

http://www.activexperts.com/ActivEmail/ provides a means for accomplishing it, if you're wanting to try that instead.

0
 
AmazingTechCommented:
Try it this way.
Set objEmail = CreateObject("CDO.Message")
 
objEmail.Subject = "Test Mail" 
objEmail.From = "me@mail.com" 
objEmail.To= "you@mail.com"
objEmail.TextBody =  "This is an important email"
 
objEmail.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
objEmail.Configuration.Fields.Item _ 
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _ 
"smtp.east.cox.net" 
objEmail.Configuration.Fields.Item _ 
 ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
objEmail.Configuration.Fields.Update 
 
objEmail.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") = "High"
objEmail.Fields.Item("urn:schemas:mailheader:X-Priority") = 2
objEmail.Fields.Item("urn:schemas:httpmail:importance") = 2
objEmail.Fields.Update
 
objEmail.Send

Open in new window

0
 
sirbountyCommented:
what's different from my first post?
0
 
abgtempAuthor Commented:
Sir Bounty, I'm not quite sure what was wrong, but I could not get your code to work. But this was this was a coding error on my part. After looking at Amazing Tech's solution, it appears that I didn't do something right. Since Sir Bounty did have this solution earlier but I was unable to code it correctly, I will give him the most points. But I do thank Amazing Tech for providing a code using my existing code. Thanks to both of you. I'm bumping up the points and splitting the points.
0
 
AmazingTechCommented:
I glad it worked for you abgtemp.
0
 
sirbountyCommented:
Probably because your cdo mail object was named objEmail and the one from the example link was cdoMail.  Presumably that wasn't changed?

Anyway - glad you got it working.  Thanx for the grade! :^)
0
 
FWAdminCommented:
Missing line was:
objEmail.Fields.Update

instead of only:
objEmail.Configuration.Fields.Update

0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now