I have a vbs script which sends an email using the default outlook account on the machine. The problem i have is that not everyone who uses the script will have an outlook profile setup beforehand, but they will have an exchange profile. I need a way to send the email by specifying the accound details to use.
This is what i have so far:
I just need help specifying the exchange account (i am making the vbs script on the fly with another application so the username and password for the account can be written in if required)
Dim ol, ns, newMail
ToAddress = "Recipients Address"
MessageSubject = "Subject"
MessageBody = "Message Body"
MessageAttachment = "Attchment Path"
Set ol = WScript.CreateObject("Outlook.Application")
Set ns = ol.getNamespace("MAPI")
Set newMail = ol.CreateItem(olMailItem)
newMail.Subject = MessageSubject
newMail.Body = MessageBody & vbCrLf
' validate the recipient, just in case...
Set myRecipient = ns.CreateRecipient(ToAddress)
If Not myRecipient.Resolved Then
MsgBox "unknown recipient"
Set ol = Nothing
Does anyone know if this is possible??