Link to home
Start Free TrialLog in
Avatar of Colin Brazier
Colin BrazierFlag for United Kingdom of Great Britain and Northern Ireland

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.Configuration")
      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("usremail")
            .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
Avatar of Preece
Preece
Flag of United States of America image

ASKER CERTIFIED SOLUTION
Avatar of alorentz
alorentz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Colin Brazier

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

Variable underfined means the constants defined in this code are not available:

<!--  
METADATA  
TYPE="typelib"  
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"  
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

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.
alorentz,

Using vbs the script runs without even sending the email.  When I comment out the message.fields.item(cdoImportance) 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