Solved

VB Script to send email giving error

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 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