• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 968
  • Last Modified:

VB Script to send email giving error

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
ghelaniabhishek
Asked:
ghelaniabhishek
1 Solution
 
JoeNuvoCommented:
one simple thing to check is the antivirus setting.
some antivirus software will include the e-mail check/blocking. (POP3/SMTP etc).
0
 
CSIPComputingCommented:
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
 
ghelaniabhishekAuthor Commented:
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
 
CSIPComputingCommented:
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
 
RobSampsonCommented:
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now