charlie324
asked on
Change FROM address for Sending Email - VBscript
Hello,
I am using the below sample script which I have found on EE to send emails. I am trying to change the from address in the script, but its not being sent from the FROM address given, its sending the from the same as its connecting to the server, ie: sEmailAddress
Can someone please advise?
Thanks
I am using the below sample script which I have found on EE to send emails. I am trying to change the from address in the script, but its not being sent from the FROM address given, its sending the from the same as its connecting to the server, ie: sEmailAddress
Can someone please advise?
Thanks
Sub SendEmail(sSubject, sEmailText, sEmailAddress, sPassword, sTo, sCCEmailAddress, sAttachment)
Set oEmail = CreateObject("CDO.Message")
oEmail.From = "test@test.com"
oEmail.To = sTo
oEmail.CC = sCCEmailAddress
oEmail.AddAttachment sAttachment
oEmail.Subject = sSubject
oEmail.HTMLbody = sEmailText
sSchema = "http://schemas.microsoft.com/cdo/configuration/"
oEmail.Configuration.Fields.Item(sSchema & "sendusing") = 2
oEmail.Configuration.Fields.Item(sSchema & "smtpserver") = "smtp.test.com"
oEmail.Configuration.Fields.Item(sSchema & "smtpserverport") = 465
oEmail.Configuration.Fields.Item(sSchema & "smtpauthenticate") = 1
oEmail.Configuration.Fields.Item(sSchema & "sendusername") = sEmailAddress
oEmail.Configuration.Fields.Item(sSchema & "sendpassword") = sPassword
oEmail.Configuration.Fields.Item(sSchema & "smtpusessl") = 1
oEmail.Configuration.Fields.Item(sSchema & "smtpconnectiontimeout") = 60
oEmail.Configuration.Fields.Update
oEmail.Send
Set oEmail = Nothing
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oEmail.From = New Net.Mail.MailAddress("test