[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2195
  • Last Modified:

CDO error '8004020f'

Hi,

I have hosting through godaddy, I have all the information in correctly, however whenever I try to send outside my domain it gives me that error, i can send inside fine, can you review my code and help please? Thanks!
Dim MYCDOMAIL, MYCDO

MyCDO.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver")= "mail.mysmtp.com"
MYCDO.fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 3535
MYCDO.fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")= 60
MYCDO.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
MYCDO.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "orders@mydomain.com"
MYCDO.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"
MYCDO.fields.Update
Set MYCDOMAIL.Configuration = MYCDO

MYCDOMAIL.Subject="Order #"&SESSION("OID")&""
MYCDOMAIL.From="orders@mydomain.com"
MYCDOMAIL.To=""& email_address&""
MYCDOMAIL.BCC = "orders@mydomain.com"
MYCDOMAIL.HTMLBody=""&OrderHeader&""&HTMLEMAIL&"<br><br>"&PRODUCTDETAILS&"<br><br>"&BillToShipTo&""
MYCDOMAIL.Send
0
LTY83
Asked:
LTY83
  • 7
  • 6
  • 5
  • +1
2 Solutions
 
fritz_the_blankCommented:
I have used this routine and it has always worked well (just plug in your parameters and give it a whirl):

' ** SUBROUTINE TO SEND EMAIL USING CDOSYS **

'**USAGE **
'strMailBody="<Font Color=Red><B>Test HTML String</B></Font>"
'CALL SendMailCDOSYS("a@b.com","c@d.com","test",strMailBody,True,"mail.yahoo.com")

Sub SendMailCDOSYS(strFrom,strTO,strSubject,strMailBody,blnHTML,sMailServer)
On Error Resume Next
     Dim objCDOConf,objCDOSYS
     ' ** CREATE THE E-MAIL SERVER OBJECT **
     Set objCDOSYS = Server.CreateObject("CDO.Message")
     Set objCDOConf = Server.CreateObject ("CDO.Configuration")

     ' ** SET AND UPDATE FIELDS PROPERTIES **
     With objCDOConf
          ' ** OUT GOING SMTP SERVER **
          .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sMailServer
          ' ** SMTP PORT **
          .Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport")  = 25
          ' ** CDO PORT **
          .Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
          ' ** TIMEOUT **
          .Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
          .Fields.Update
     End With

     ' ** UPDATE THE CDOSYS CONFIGURATION **
     Set objCDOSYS.Configuration = objCDOConf

     With objCDOSYS    
          ' ** WHO THE E-MAIL IS FROM **
          .From = strFrom

          ' ** WHO THE E-MAIL IS SENT TO **
          .To = strTo
                   
          ' ** THE SUBJECT OF THE E-MAIL **
          .Subject = strSubject
           
          ' ** SET THE E-MAIL BODY FORMAT (HTMLBody=HTML TextBody=Plain) **
          If blnHTML = True Then
          .HTMLBody = strMailBody
          Else
          .TextBody = strMailBody
          End If
           
          ' ** SEND THE E-MAIL **
          .Send
     End with                    
       
     ' ** CLOSE THE SERVER MAIL OBJECT **
     Set objCDOSYS = Nothing
End Sub


0
 
LTY83Author Commented:
i added sendusername/sendpassword info but lemme try, i'll let u know
0
 
LTY83Author Commented:
same error :(
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
fritz_the_blankCommented:
Okay, time to check with your hosting service because that code definitely works. Perhaps they want you to use some other mail component?

FtB
0
 
LTY83Author Commented:
its godaddy, i would of thought they supported it, their tech support isn't that bright, they told me to use port 80 to connect to their mysql server...... wrong!! heh, i checked all available asp components and so no mail ones, i'll check w/ them again.

thanks
0
 
fritz_the_blankCommented:
You are very welcome and good luck to you. If you need mail scripts for whaterver component they claim to support, please let me know.

FtB
0
 
kiddangerCommented:
What is the rest of the error message?  You need to show the decriptive part of the error also.

If it requires authentication to send, usually your email address is not your username.
Are you really using port 3535?

Show what values you plugged into fritz' script.
0
 
LTY83Author Commented:
yea, godaddy makes you use port 3535, my exact error message is  '80040211'
my username is my email address,

I have successfully sent inside my domain, so i know the code works, its when I send outside the domain i get the errors.
0
 
fritz_the_blankCommented:
You will definitely have to has this out with your web hosting company--they may have their SMTP set up in such a way that it doesn't send outside of it's domain, have anti-spam measures in place and etc.

FtB
0
 
fritz_the_blankCommented:
For example, you may require smtp authorization to send outside of your domain.

FtB
0
 
LTY83Author Commented:
what is the code for smtp authorization?

0
 
kiddangerCommented:
He was doing that in the first one.

LTY... which error?

"CDO error '8004020f'" or "my exact error message is  '80040211' "

When I asked for the exact error message, I was asking for the WHOLE error message.  There's more to it.  8004020f is a group error message.  There is more descriptive text that goes with it.  It's important to know.

Here are you possibilities:
http://www.aspfaq.com/show.asp?id=2305
0
 
LTY83Author Commented:
my exact error message:

error '80040211'
0
 
fritz_the_blankCommented:
I still feel that talking with the web host tech support will clear this up--who knows what they are doing there?

FtB
0
 
kiddangerCommented:
Fritz is right.  It doesn't hurt to discuss this with your host.

I will tell you this.  There are two things hosts do when they setup their email servers.
1. They set them to you have to authenticate to send.  Or...
2. They set it so you have to check mail before you can send and then there is a timeout period, so as long as you check mail before you send, it works.  If not, and the timeout period has elapsed, it fails.  I think it's a stupid way to set it up but when in Rome...
0
 
kiddangerCommented:
To fully explain #2, when you check mail, it uses your credentials and they to send they use those credentials for you to send mail until the timeout period ends.
0
 
fritz_the_blankCommented:
As for # 2--that is sort of what I was getting at in http:#13825143 when I was brought up SMTP authorization--there is more than one way to do that, and sometimes the only way to get around that is to work with the host.

FtB
0
 
satyaj_99Commented:
Hey I was facing the same problem with errors '8004020f' and '80040211'  coming all the time. What you have to do is change the username like this
Set Fields = objConfig.Fields
' Set config fields we care about
With Fields
     .Item(cdoSendUsingMethod)       = cdoSendUsingPort
     .Item(cdoSMTPServer)          = "smtp.yourdomain.org"
     .Item(cdoSMTPServerPort)        = 25
     .Item(cdoSMTPConnectionTimeout) = 10
     .Item(cdoSMTPAuthenticate)      = cdoBasic
     
///See this line
.Item(cdoSendUserName)          = "youremailacountname@domainname.com"


     .Item(cdoSendPassword)          = "yourpassword"
     .Update
End With

This fixed my problem

0
 
kiddangerCommented:
All 3 of us suggested adding authentication.  If he can send to his domain and not to others, then it's a relay problem and authentication should fix it.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

  • 7
  • 6
  • 5
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now