We help IT Professionals succeed at work.
Get Started

VB script to send pop mail only performs intermittently

ddantes
ddantes asked
on
137 Views
Last Modified: 2016-08-26
I am a novice at scripting.  I have a script which is supposed to send me an Email when it is activated, but it only does that some of the time.  I'd appreciate guidance about improving this, so that the Email is sent consistently.  Below is the script.  Some of the text has been removed, so only ""  appears, in order to preserve privacy regarding contact information, passwords, etc.

Dim emailObj
Set emailObj      = CreateObject("CDO.Message")
emailObj.From     = ""

emailObj.To       = ""

emailObj.Subject  = ""
emailObj.TextBody = ""

Dim emailConfig
Set emailConfig = emailObj.Configuration

emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.maui.net"
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing")    = 2  
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1  
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl")      = false 
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername")    = ""
emailConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword")    = ""
emailConfig.Fields.Update

emailObj.Send

'If err.number = 0 then Msgbox "Done"

Open in new window

Comment
Watch Question
IT Manager
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE