I had to create a .VBS script to
create an automated E-Mail message. The hardest part was to set the
importance of the mail, I've found the solution here:
http://www.lewisroberts.com/?p=64Here come's the script:
Dim
iMsg
Dim
iConf
Dim
Flds
Dim
strHTML
Dim
strSmartHost
StrSmartHost =
"MAIL SERVER"
set
iMsg = CreateObject(
"CDO.Message"
)
set
iConf = CreateObject(
"CDO.Configuration"
)
Set
Flds = iConf.Fields
' IConfiguration.Fields Property Link
With
Flds
'1=Send message using the local SMTP service pickup directory.
'2=Send the message using the network (SMTP over the network),
.Item(
"http://schemas.microsoft.com/cdo/configuration/sendusing"
) =
2
.Item(
"http://schemas.microsoft.com/cdo/configuration/smtpserver"
) = strSmartHost
.Item(
"http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
) =
10
' 2 for NTLM, 1 for basic, 0 for none (the default)
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0
'Use SSL for the connection (True or False):
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
'.item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = USER
'.item("http://schemas.microsoft.com/cdo/configuration/sendusername") = PASS
.update
End With
With
iMsg
Set
.Configuration = iConf
'set mail importance
' For Outlook 2003:
.Fields.Item(
"urn:schemas:mailheader:X-MSMail-Priority"
) =
"High"
' For Outlook 2003 also:
.Fields.Item(
"urn:schemas:mailheader:X-Priority"
) =
2
' For Outlook Express:
.Fields.Item(
"urn:schemas:httpmail:importance"
) =
2
.Fields.Update
.
To
=
"YOUR_MAIL_ADDRESS"
'.Cc = varMail_Cc
'.Bcc = varMail_Bcc
.From =
"FROM_MAIL_ADDRESS"
.Subject =
"se topic"
' if varMail_HTML = True then
' .HTMLBody = varMail_Text 'html mail
' else
.Textbody =
"hier kommt der mailbody"
'text mail
' end if
'uncomment the next line and alter file path as required
'Set iBP = iMsg.AddAttachment(App.Path & "\file1.txt")
.Send
End With
' cleanup of variables
Set
iMsg =
Nothing
Set
iConf =
Nothing
Set
Flds =
Nothing