Solved

VB Script to send email giving error

Posted on 2011-02-13
5
938 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Unlike scripting languages such as C# where a semi-colon is used to indicate the end of a command, Microsoft's VBScript language relies on line breaks to determine when a command begins and ends. As you can imagine, this quickly results in messy cod…
I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 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