Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - VBScript to send email not working on 1 server

Reply
 
Old 01-18-2009   #1 (permalink)
RemyMaza


 
 

VBScript to send email not working on 1 server

I have this script that works great on many machines except the one
I'd like to run it on. I think the problem lies with the fact that
the Security Config Wizard has been run on it. What do I need to turn
on in order for this to work? I have opened port 25 on the firewall
but that didn't really work. I think it's a service that I'll need to
start but I'm not sure which...

Function SendEmail(subject, body)
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "email@xxxxxx"
objEmail.To = "email@xxxxxx"
objEmail.Subject = subject
objEmail.Textbody = body

'Mail configuration
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
strMailserver
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
25
objEmail.Configuration.Fields.Update

'Send E-mail
objEmail.Send

'Write to the event log
Call WriteEvent(subject,body)

End Function


Thanks in advance...

Matt

My System SpecsSystem Spec
Old 01-18-2009   #2 (permalink)
Pegasus \(MVP\)


 
 

Re: VBScript to send email not working on 1 server


"RemyMaza" <RemyMaza@xxxxxx> wrote in message
news:597921eb-2965-447f-898a-cd77192313c4@xxxxxx
Quote:

>I have this script that works great on many machines except the one
> I'd like to run it on. I think the problem lies with the fact that
> the Security Config Wizard has been run on it. What do I need to turn
> on in order for this to work? I have opened port 25 on the firewall
> but that didn't really work. I think it's a service that I'll need to
> start but I'm not sure which...
>
> Function SendEmail(subject, body)
> Set objEmail = CreateObject("CDO.Message")
> objEmail.From = "email@xxxxxx"
> objEmail.To = "email@xxxxxx"
> objEmail.Subject = subject
> objEmail.Textbody = body
>
> 'Mail configuration
> objEmail.Configuration.Fields.Item _
> ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
> objEmail.Configuration.Fields.Item _
> ("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
> strMailserver
> objEmail.Configuration.Fields.Item _
> ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
> 25
> objEmail.Configuration.Fields.Update
>
> 'Send E-mail
> objEmail.Send
>
> 'Write to the event log
> Call WriteEvent(subject,body)
>
> End Function
>
>
> Thanks in advance...
>
> Matt
Hard to say - you didn't include any error messages in your post. It could
be a password issue. If so then you should send the user's name and his
password to the SMTP server - see below:

Function SendEmail(subject, body)
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "remy@xxxxxx"
objEmail.To = "remy@xxxxxx"
objEmail.Subject = subject
objEmail.Textbody = body
schema = "http://schemas.microsoft.com/cdo/configuration/"

'Mail configuration
With objEmail.configuration.fields
.Item(schema & "sendusing") = 2
.Item(schema & "smtpserver") = strMailserver
.Item(schema & "smtpserverport") = 25
.Item(schema & "sendusername") = "support@xxxxxx"
.Item(schema & "sendpassword") = "abcxyz"
.Update
End With
'Send E-mail
objEmail.Send

If your script does not generate any error messages then you might try and
send a message with blat.exe, using the same parameters. You can download
this tool from a number of sites.


My System SpecsSystem Spec
Old 01-18-2009   #3 (permalink)
Richard Mueller [MVP]


 
 

Re: VBScript to send email not working on 1 server


"Pegasus (MVP)" <I.can@xxxxxx> wrote in message
news:OWZmveaeJHA.6012@xxxxxx
Quote:

>
> "RemyMaza" <RemyMaza@xxxxxx> wrote in message
> news:597921eb-2965-447f-898a-cd77192313c4@xxxxxx
Quote:

>>I have this script that works great on many machines except the one
>> I'd like to run it on. I think the problem lies with the fact that
>> the Security Config Wizard has been run on it. What do I need to turn
>> on in order for this to work? I have opened port 25 on the firewall
>> but that didn't really work. I think it's a service that I'll need to
>> start but I'm not sure which...
>>
>> Function SendEmail(subject, body)
>> Set objEmail = CreateObject("CDO.Message")
>> objEmail.From = "email@xxxxxx"
>> objEmail.To = "email@xxxxxx"
>> objEmail.Subject = subject
>> objEmail.Textbody = body
>>
>> 'Mail configuration
>> objEmail.Configuration.Fields.Item _
>> ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
>> objEmail.Configuration.Fields.Item _
>> ("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
>> strMailserver
>> objEmail.Configuration.Fields.Item _
>> ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
>> 25
>> objEmail.Configuration.Fields.Update
>>
>> 'Send E-mail
>> objEmail.Send
>>
>> 'Write to the event log
>> Call WriteEvent(subject,body)
>>
>> End Function
>>
>>
>> Thanks in advance...
>>
>> Matt
>
> Hard to say - you didn't include any error messages in your post. It could
> be a password issue. If so then you should send the user's name and his
> password to the SMTP server - see below:
>
> Function SendEmail(subject, body)
> Set objEmail = CreateObject("CDO.Message")
> objEmail.From = "remy@xxxxxx"
> objEmail.To = "remy@xxxxxx"
> objEmail.Subject = subject
> objEmail.Textbody = body
> schema = "http://schemas.microsoft.com/cdo/configuration/"
>
> 'Mail configuration
> With objEmail.configuration.fields
> .Item(schema & "sendusing") = 2
> .Item(schema & "smtpserver") = strMailserver
> .Item(schema & "smtpserverport") = 25
> .Item(schema & "sendusername") = "support@xxxxxx"
> .Item(schema & "sendpassword") = "abcxyz"
> .Update
> End With
> 'Send E-mail
> objEmail.Send
>
> If your script does not generate any error messages then you might try and
> send a message with blat.exe, using the same parameters. You can download
> this tool from a number of sites.
>
Maybe this article will help.

http://support.microsoft.com/kb/910360

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 01-18-2009   #4 (permalink)
RemyMaza


 
 

Re: VBScript to send email not working on 1 server

On Jan 18, 3:02*pm, "Pegasus \(MVP\)" <I....@xxxxxx> wrote:
Quote:

> "RemyMaza" <RemyM...@xxxxxx> wrote in message
>
> news:597921eb-2965-447f-898a-cd77192313c4@xxxxxx
>
>
>
>
>
Quote:

> >I have this script that works great on many machines except the one
> > I'd like to run it on. *I think the problem lies with the fact that
> > the Security Config Wizard has been run on it. *What do I need to turn
> > on in order for this to work? *I have opened port 25 on the firewall
> > but that didn't really work. *I think it's a service that I'll need to
> > start but I'm not sure which...
>
Quote:

> > Function SendEmail(subject, body)
> > Set objEmail = CreateObject("CDO.Message")
> > objEmail.From = "em...@xxxxxx"
> > objEmail.To = "em...@xxxxxx"
> > objEmail.Subject = subject
> > objEmail.Textbody = body
>
Quote:

> > 'Mail configuration
> > objEmail.Configuration.Fields.Item _
> > ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
> > objEmail.Configuration.Fields.Item _
> > ("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
> > strMailserver
> > objEmail.Configuration.Fields.Item _
> > ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
> > 25
> > objEmail.Configuration.Fields.Update
>
Quote:

> > 'Send E-mail
> > objEmail.Send
>
Quote:

> > *'Write to the event log
> > *Call WriteEvent(subject,body)
>
Quote:

> > End Function
>
Quote:

> > Thanks in advance...
>
Quote:

> > Matt
>
> Hard to say - you didn't include any error messages in your post. It could
> be a password issue. If so then you should send the user's name and his
> password to the SMTP server - see below:
>
> Function SendEmail(subject, body)
> Set objEmail = CreateObject("CDO.Message")
> objEmail.From = "r...@xxxxxx"
> objEmail.To = "r...@xxxxxx"
> objEmail.Subject = subject
> objEmail.Textbody = body
> schema = "http://schemas.microsoft.com/cdo/configuration/"
>
> 'Mail configuration
> With objEmail.configuration.fields
> *.Item(schema & "sendusing") = 2
> *.Item(schema & "smtpserver") = strMailserver
> *.Item(schema & "smtpserverport") = 25
> *.Item(schema & "sendusername") = "supp...@xxxxxx"
> *.Item(schema & "sendpassword") = "abcxyz"
> *.Update
> End With
> 'Send E-mail
> objEmail.Send
>
> If your script does not generate any error messages then you might try and
> send a message with blat.exe, using the same parameters. You can download
> this tool from a number of sites.- Hide quoted text -
>
> - Show quoted text -
That's exactly what it's doing. No email and no error messages. I
think I'm going to use blat for this particular problem. I'll post
back to let you guys know if this works. Thanks to everyone for the
great help.

Matt
My System SpecsSystem Spec
Old 01-18-2009   #5 (permalink)
RemyMaza


 
 

Re: VBScript to send email not working on 1 server

On Jan 18, 6:29*pm, RemyMaza <RemyM...@xxxxxx> wrote:
Quote:

> On Jan 18, 3:02*pm, "Pegasus \(MVP\)" <I....@xxxxxx> wrote:
>
>
>
>
>
Quote:

> > "RemyMaza" <RemyM...@xxxxxx> wrote in message
>
Quote:

> >news:597921eb-2965-447f-898a-cd77192313c4@xxxxxx
>
Quote:
Quote:

> > >I have this script that works great on many machines except the one
> > > I'd like to run it on. *I think the problem lies with the fact that
> > > the Security Config Wizard has been run on it. *What do I need to turn
> > > on in order for this to work? *I have opened port 25 on the firewall
> > > but that didn't really work. *I think it's a service that I'll needto
> > > start but I'm not sure which...
>
Quote:
Quote:

> > > Function SendEmail(subject, body)
> > > Set objEmail = CreateObject("CDO.Message")
> > > objEmail.From = "em...@xxxxxx"
> > > objEmail.To = "em...@xxxxxx"
> > > objEmail.Subject = subject
> > > objEmail.Textbody = body
>
Quote:
Quote:

> > > 'Mail configuration
> > > objEmail.Configuration.Fields.Item _
> > > ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
> > > objEmail.Configuration.Fields.Item _
> > > ("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
> > > strMailserver
> > > objEmail.Configuration.Fields.Item _
> > > ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
> > > 25
> > > objEmail.Configuration.Fields.Update
>
Quote:
Quote:

> > > 'Send E-mail
> > > objEmail.Send
>
Quote:
Quote:

> > > *'Write to the event log
> > > *Call WriteEvent(subject,body)
>
Quote:
Quote:

> > > End Function
>
Quote:
Quote:

> > > Thanks in advance...
>
Quote:
Quote:

> > > Matt
>
Quote:

> > Hard to say - you didn't include any error messages in your post. It could
> > be a password issue. If so then you should send the user's name and his
> > password to the SMTP server - see below:
>
Quote:

> > Function SendEmail(subject, body)
> > Set objEmail = CreateObject("CDO.Message")
> > objEmail.From = "r...@xxxxxx"
> > objEmail.To = "r...@xxxxxx"
> > objEmail.Subject = subject
> > objEmail.Textbody = body
> > schema = "http://schemas.microsoft.com/cdo/configuration/"
>
Quote:

> > 'Mail configuration
> > With objEmail.configuration.fields
> > *.Item(schema & "sendusing") = 2
> > *.Item(schema & "smtpserver") = strMailserver
> > *.Item(schema & "smtpserverport") = 25
> > *.Item(schema & "sendusername") = "supp...@xxxxxx"
> > *.Item(schema & "sendpassword") = "abcxyz"
> > *.Update
> > End With
> > 'Send E-mail
> > objEmail.Send
>
Quote:

> > If your script does not generate any error messages then you might try and
> > send a message with blat.exe, using the same parameters. You can download
> > this tool from a number of sites.- Hide quoted text -
>
Quote:

> > - Show quoted text -
>
> That's exactly what it's doing. *No email and no error messages. *I
> think I'm going to use blat for this particular problem. *I'll post
> back to let you guys know if this works. *Thanks to everyone for the
> great help.
>
> Matt- Hide quoted text -
>
> - Show quoted text -
That's not going to work out either. I just tried a simple telnet
test to the smtp server and I can't get in. I'm not sure what to look
at now, definitely a local problem with the box.

My System SpecsSystem Spec
Old 01-28-2009   #6 (permalink)
RemyMaza


 
 

Re: VBScript to send email not working on 1 server

On Jan 18, 6:49*pm, RemyMaza <RemyM...@xxxxxx> wrote:
Quote:

> On Jan 18, 6:29*pm, RemyMaza <RemyM...@xxxxxx> wrote:
>
>
>
>
>
Quote:

> > On Jan 18, 3:02*pm, "Pegasus \(MVP\)" <I....@xxxxxx> wrote:
>
Quote:
Quote:

> > > "RemyMaza" <RemyM...@xxxxxx> wrote in message
>
Quote:
Quote:

> > >news:597921eb-2965-447f-898a-cd77192313c4@xxxxxx
>
Quote:
Quote:

> > > >I have this script that works great on many machines except the one
> > > > I'd like to run it on. *I think the problem lies with the fact that
> > > > the Security Config Wizard has been run on it. *What do I need toturn
> > > > on in order for this to work? *I have opened port 25 on the firewall
> > > > but that didn't really work. *I think it's a service that I'll need to
> > > > start but I'm not sure which...
>
Quote:
Quote:

> > > > Function SendEmail(subject, body)
> > > > Set objEmail = CreateObject("CDO.Message")
> > > > objEmail.From = "em...@xxxxxx"
> > > > objEmail.To = "em...@xxxxxx"
> > > > objEmail.Subject = subject
> > > > objEmail.Textbody = body
>
Quote:
Quote:

> > > > 'Mail configuration
> > > > objEmail.Configuration.Fields.Item _
> > > > ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
> > > > objEmail.Configuration.Fields.Item _
> > > > ("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
> > > > strMailserver
> > > > objEmail.Configuration.Fields.Item _
> > > > ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
> > > > 25
> > > > objEmail.Configuration.Fields.Update
>
Quote:
Quote:

> > > > 'Send E-mail
> > > > objEmail.Send
>
Quote:
Quote:

> > > > *'Write to the event log
> > > > *Call WriteEvent(subject,body)
>
Quote:
Quote:

> > > > End Function
>
Quote:
Quote:

> > > > Thanks in advance...
>
Quote:
Quote:

> > > > Matt
>
Quote:
Quote:

> > > Hard to say - you didn't include any error messages in your post. It could
> > > be a password issue. If so then you should send the user's name and his
> > > password to the SMTP server - see below:
>
Quote:
Quote:

> > > Function SendEmail(subject, body)
> > > Set objEmail = CreateObject("CDO.Message")
> > > objEmail.From = "r...@xxxxxx"
> > > objEmail.To = "r...@xxxxxx"
> > > objEmail.Subject = subject
> > > objEmail.Textbody = body
> > > schema = "http://schemas.microsoft.com/cdo/configuration/"
>
Quote:
Quote:

> > > 'Mail configuration
> > > With objEmail.configuration.fields
> > > *.Item(schema & "sendusing") = 2
> > > *.Item(schema & "smtpserver") = strMailserver
> > > *.Item(schema & "smtpserverport") = 25
> > > *.Item(schema & "sendusername") = "supp...@xxxxxx"
> > > *.Item(schema & "sendpassword") = "abcxyz"
> > > *.Update
> > > End With
> > > 'Send E-mail
> > > objEmail.Send
>
Quote:
Quote:

> > > If your script does not generate any error messages then you might try and
> > > send a message with blat.exe, using the same parameters. You can download
> > > this tool from a number of sites.- Hide quoted text -
>
Quote:
Quote:

> > > - Show quoted text -
>
Quote:

> > That's exactly what it's doing. *No email and no error messages. *I
> > think I'm going to use blat for this particular problem. *I'll post
> > back to let you guys know if this works. *Thanks to everyone for the
> > great help.
>
Quote:

> > Matt- Hide quoted text -
>
Quote:

> > - Show quoted text -
>
> That's not going to work out either. *I just tried a simple telnet
> test to the smtp server and I can't get in. *I'm not sure what to look
> at now, definitely a local problem with the box.- Hide quoted text -
>
> - Show quoted text -
Ended up being the Virus scanner didn't like cscript sending emails.
I created a rule for that and now everything works perfect. Thanks
for everyone's help!

Regards,
Matt
My System SpecsSystem Spec
Old 01-28-2009   #7 (permalink)
Al Dunbar


 
 

Re: VBScript to send email not working on 1 server


"RemyMaza" <RemyMaza@xxxxxx> wrote in message
news:f3402f7e-2d33-4b68-9ccd-cab61a91ff67@xxxxxx
On Jan 18, 6:49 pm, RemyMaza <RemyM...@xxxxxx> wrote:
Quote:

> On Jan 18, 6:29 pm, RemyMaza <RemyM...@xxxxxx> wrote:
>
>
>
>
>
Quote:

> > On Jan 18, 3:02 pm, "Pegasus \(MVP\)" <I....@xxxxxx> wrote:
>
Quote:
Quote:

> > > "RemyMaza" <RemyM...@xxxxxx> wrote in message
>
Quote:
Quote:

> > >news:597921eb-2965-447f-898a-cd77192313c4@xxxxxx
>
Quote:
Quote:

> > > >I have this script that works great on many machines except the one
> > > > I'd like to run it on. I think the problem lies with the fact that
> > > > the Security Config Wizard has been run on it. What do I need to
> > > > turn
> > > > on in order for this to work? I have opened port 25 on the firewall
> > > > but that didn't really work. I think it's a service that I'll need
> > > > to
> > > > start but I'm not sure which...
>
Quote:
Quote:

> > > > Function SendEmail(subject, body)
> > > > Set objEmail = CreateObject("CDO.Message")
> > > > objEmail.From = "em...@xxxxxx"
> > > > objEmail.To = "em...@xxxxxx"
> > > > objEmail.Subject = subject
> > > > objEmail.Textbody = body
>
Quote:
Quote:

> > > > 'Mail configuration
> > > > objEmail.Configuration.Fields.Item _
> > > > ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
> > > > objEmail.Configuration.Fields.Item _
> > > > ("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
> > > > strMailserver
> > > > objEmail.Configuration.Fields.Item _
> > > > ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =
> > > > 25
> > > > objEmail.Configuration.Fields.Update
>
Quote:
Quote:

> > > > 'Send E-mail
> > > > objEmail.Send
>
Quote:
Quote:

> > > > 'Write to the event log
> > > > Call WriteEvent(subject,body)
>
Quote:
Quote:

> > > > End Function
>
Quote:
Quote:

> > > > Thanks in advance...
>
Quote:
Quote:

> > > > Matt
<snip>

Ended up being the Virus scanner didn't like cscript sending emails.
I created a rule for that and now everything works perfect. Thanks
for everyone's help!

===> You might consider reviewing your AV configuration to determine why it
is not the same everywhere. The more permiscuous configurations might be
allowing more than just the odd automated mail message to get through...

/Al


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
can't send email - connection to server failed Vista mail
VBScript to send email not working on 1 server VB Script
Can't send email through POP3 server Browsers & Mail
Can't send email through POP3 server Vista mail
Windows mail can't send email but in XP/2000 pro. send working OK Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46