We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

VBScript email sending script..need modification..

Medium Priority
429 Views
Last Modified: 2012-05-11
Hello Experts ..

I have this code which successfully sends email if i use our SMTP server.If external or public like gmail is used it wont work.. I would like to know how can we modify it to send email using public SMTP servers as well.

SMTPServer = "mx1.*****.com"
Recipient = "subhash.chandra@zenihinfotech.com"
From = "subhash.chandra@zenithinotech.com"
Subject = "Test email"
Message = "This is the email subject"


GenericSendmail SMTPserver, From, Recipient, Subject, Message

Sub GenericSendmail (SMTPserver, From, Recipient, Subject, Message)

set msg = WScript.CreateObject("CDO.Message")
msg.From = From
msg.To = Recipient
msg.Subject = Subject
msg.TextBody = Message
msg.Configuration.Fields ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
msg.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
msg.Configuration.Fields.Update
msg.Send
End Sub

Open in new window



Thank you much for looking into this ..
Comment
Watch Question

Top Expert 2011

Commented:

Author

Commented:
can you please explain how it works..i am no voice in VBscript
Top Expert 2011
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks  for the help guys..both script is working fine. Much appreciated.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.