Solved

CDO Sends to some addresses, but not to others

Posted on 2013-11-19
9
310 Views
Last Modified: 2015-01-05
Hello Experts,

I have the sub-routine below.  When I pass certain addresses to strEmailTo (ie- mine), it works, but when I pass another address I get the following error

The server rejected one or more recipient addresses. The server response was: 550 Requested action not taken: mailbox unavailable or not local

I thought that the important thing here is outgoing and as you will see I have a constants for my smtp.

I think that this is a server settings, but not sure how to go about it? Yes, I have full access to my server (RMD).

Any help will be appreciated.

My code is
Function SendEmail(strEmailTo, strEmailFrom, strEmailSubject, strEmailBody, strAttach) 

	Dim objMessage 
	Dim objConf
	Dim objFlds

	Const cdoSendUsingPort = 2
	strSMTPHost = "mail.apdcompany.ca"

	Set objMessage=Server.CreateObject("CDO.Message")
	set objConf = CreateObject("CDO.Configuration") 


	Set objFlds = objConf.Fields
	With objFlds
		.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
		.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPHost
		.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
		.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "donotreply@abccompany.ca"
		.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "123abc"
		.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
		.Update
	End With

	With objMessage
		Set .Configuration = objConf
		.To = strEmailTo
		.From = strEmailFrom
		.Subject = strEmailSubject
		.HTMLBody = strEmailBody
	End With

	If strAttach <> "" Then
		objMessage.AddAttachment strAttach
	End If

	On Error Resume Next 

		objMessage.Send 
		If Err.Number <> 0 Then 
	
			Response.write(Err.Description)
			Err.Clear 
	
		End If 
	
	
	On Error Goto 0


	Set objMessage=Nothing 
	Set objConf = Nothing
	Set objFlds = Nothing

End Function

Open in new window

0
Comment
Question by:APD_Toronto
  • 4
  • 3
  • 2
9 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 250 total points
ID: 39661194
Sounds like your server is not allowing relaying to outside email addresses.  Are the failing email addresses internal or external?  How are you getting the NDR messages?  And what email server software is at "mail.apdcompany.ca"?
0
 

Author Comment

by:APD_Toronto
ID: 39661208
The outgoing email addresses are both internal, but mostly external and can be anything like @Hotmail.com, @gmail.com, @apdcompany.ca.

I am using MailEnable.
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 250 total points
ID: 39661239
If the mailbox is really available then it sounds like the domain you are sending the email to is incorrectly configured for receiving email i.e. they are not pointing their records to whoever is hosting their email server.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39661242
For Hotmail, Yahoo, Gmail, and AOL, you need to be sending from an email account that can be verified.  A "donotreply" account may not work.  They spend a lot more time trying to reject spam than delivering email.
0
 

Author Comment

by:APD_Toronto
ID: 39661260
I really don't understand?  

I cannot configure / do an exception for all possible domains.

For example, this is for one-time purchasers for around the globe, and I have a spot where I ask, to which address to e-mail a copy of their receipt?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39661305
Your personal emails to your friends may go thru 'easily' but email is still, after all this time, a big mess.  Spam is such a big problem that major mail servers spend something 80% of the time dealing with it.  Hotmail, Yahoo, Gmail, and AOL all rate your email 'reputation' when deciding to let you send email to their accounts.  They would prefer to bounce your email if there is any question in their 'minds'.

And believe it or not, not all mail servers use exactly the same standard for email.  The major servers have been 'tightening up' their standards as an aid to filtering out spam.  I don't think this is your situation but in one question we had, the asker was getting a bounce message saying that the methods he had been using for many years were no longer acceptable.

There is no 'answer' as such.  Remember also that spam is defined by the person or server receiving the email, spam is what they say it is.  Here is a site that says it will check your emails for free against spam indicators: http://www.emailspamtest.com/
0
 
LVL 58

Expert Comment

by:Gary
ID: 39661380
David brings up good points. Is it possible you can give us an example email?
0
 

Author Comment

by:APD_Toronto
ID: 39663390
I really don't think this is a spam issue, but rather a internal server setting on my server in delivering to external addresses
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39663558
There are many questions here similar to yours, many of them never find an answer they like.  

First, you don't decide what is spam, the receiver does.  Spam is nothing more than unwanted email.  Hotmail and Yahoo in particular are very good at rejecting email from sources that they haven't yet 'approved'.  Trouble is, no one seems to know how to get approved.  Even plain text emails can get bounced by Hotmail simply because they're never heard of your or you are sending from an email address they can't verify.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

856 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