guyver_news
06-06-2002, 04:59 PM
Dear all,
I wish to send an email using scripting, however, my situation is that the script below uses outlook (which is good) but if outlook is configured with multiple profiles, I am unable to send the email.
Is there another way to send email? or how can I overcome this profile issue.
Also, how can I call Outlook express instead of Microsoft outlook?
If you can answer both my questions, thanks in advance.
Kind regards
Paul
=======
Sub Sendemail
Dim WshShell
Dim appOutl
Dim maiMail
Dim recMessage
Dim messsubject
Dim LogTime
Dim LogDate
LogTime = Time
LogDate = Date
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set appOutl = Wscript.CreateObject("Outlook.Application")
' Set a reference to the MailItem object.
Set maiMail = appOutl.CreateItem(0)
' Get an address from the user.
maiMail.Recipients.Add("dude@dude.com")
' Add subject and body text.
messsubject = "DB Backup copy to main server completed at " & " " & LogDate & " " & LogTime
maiMail.Subject = messsubject
maiMail.Body = "See logs for details"
' Send the mail.
maiMail.Send
' Close object references.
Set appOutl = Nothing
Set maiMail = Nothing
Set recMessage = Nothing
End Sub
I wish to send an email using scripting, however, my situation is that the script below uses outlook (which is good) but if outlook is configured with multiple profiles, I am unable to send the email.
Is there another way to send email? or how can I overcome this profile issue.
Also, how can I call Outlook express instead of Microsoft outlook?
If you can answer both my questions, thanks in advance.
Kind regards
Paul
=======
Sub Sendemail
Dim WshShell
Dim appOutl
Dim maiMail
Dim recMessage
Dim messsubject
Dim LogTime
Dim LogDate
LogTime = Time
LogDate = Date
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set appOutl = Wscript.CreateObject("Outlook.Application")
' Set a reference to the MailItem object.
Set maiMail = appOutl.CreateItem(0)
' Get an address from the user.
maiMail.Recipients.Add("dude@dude.com")
' Add subject and body text.
messsubject = "DB Backup copy to main server completed at " & " " & LogDate & " " & LogTime
maiMail.Subject = messsubject
maiMail.Body = "See logs for details"
' Send the mail.
maiMail.Send
' Close object references.
Set appOutl = Nothing
Set maiMail = Nothing
Set recMessage = Nothing
End Sub