Solved

VB Script to send email giving error

Posted on 2011-02-13
5
932 Views
Last Modified: 2012-05-11
I am tring to test a script that sends emails.
I have written following code,

It gives me following error:

The server rejected one or more recipient addresses. The server response was: 454 4.7.1 <xxx@xxx.com>: Recipient address rejected: Access denied.

Now, if I run this same script from a different server, it works fine. This means the smtp server I have mentioned is not blocking anything.

Can somebody please help?
Const FOF_CREATEPROGRESSDLG = &H0&
strServer = "mail.server.com"
strTo = "xxx@xxx.com"
strFrom = "xxx@xxx.com"
strSubject = "Test Mail"
Set objMessage = CreateObject("CDO.Message")
strText = "Test mail "
objMessage.To = strTo
objMessage.From = strFrom
objMessage.Subject = strSubject
objMessage.TextBody = strText
 
'==This section provides the configuration information for the remote SMTP server.
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strServer
'Server port (typically 25)
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25      
objMessage.Configuration.Fields.Update
'==End remote SMTP server configuration section==
objMessage.Send

Open in new window

0
Comment
Question by:ghelaniabhishek
5 Comments
 
LVL 11

Expert Comment

by:JoeNuvo
ID: 34882596
one simple thing to check is the antivirus setting.
some antivirus software will include the e-mail check/blocking. (POP3/SMTP etc).
0
 
LVL 10

Expert Comment

by:CSIPComputing
ID: 34882628
I would think that the SMTP server you are connecting to has relay restrictions applied, which means that certain IP addresses are allowed to send to anyone, however, the server you are trying to connect from is restricted.

I'd check the SMTP connector settings on the server you're connecting through.

As you are getting an SMTP response (albeit an error), I doubt AV settings are getting in the way.
0
 

Author Comment

by:ghelaniabhishek
ID: 34882660
doesnt seem to be antivirus issue. Have chekced, its blocking nothing.

Regarding SMTP server blocking, I doubt about this, since the same script with same SMTP server name works fine from my other machines. Its just one machine where the script is giving error.

some setting on my machine where script is failing needs to be changed or loocked at, not sure what.
0
 
LVL 10

Expert Comment

by:CSIPComputing
ID: 34882699
Try telnetting to the SMTP server from the problematic machine, and perform the same script functions (i.e., Issue Helo, MailFrom, RcptTo etc commands).

If you get the same knock back using Telnet, then it's the SMTP server not your source server with the problem.

An SMTP restriction can apply to a specific ip address... just becuase it works elsewhere doesn't mean it's the Source server that is at fault, nor the script (as you've proved that works).
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 250 total points
ID: 34885167
Both the experts are correct.  McAfee anti-virus has a policy setting to "Block mass-mailing worms", which you need to turn off for this to work, so if you've got McAfee, check that setting.

My SMTP server has relay settings to prohibit from any address other than specific IP addresses, so you'll probably see in your mail gateway settings that the machine that works has it's IP listed in the "Allowed" list.  Anything not in that list will be denied.

Regards,

Rob.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now