Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Problem sending email through a .ASP program

I ported a website from one webhost provider to another and now the email function on the site is not working.  The email function sends out an email to everyone on the list chosen by the user.  I've included a copy of the code that I'm using.  I'm getting the following error when the .Send is issued:

error '8004020e'

C:\WEBSPACE\RESADMIN\DYAROSH\ARDMOREROTARY.ORG\WWW\MANAGE\../includes/sendArrayEmail.asp, line 60

Line 60 is the .Send line.

If anyone can help me I would greatly appreciate it.

<%
function sendArrayEmail(arrRecips, strSubject, strMessage, strSenderName, strSenderEmail)
      Dim mailObj, mailBreak, mailTo, sch, cdoConfig
      
      mailBreak = chr(13) & chr(10) & "<br>"
      
      strMsg = Replace(strMessage, chr(13), mailBreak)

      sch="http://schemas.microsoft.com/cdo/configuration/"
      Set cdoConfig = Server.CreateObject("CDO.Configuration")
      With cdoConfig.Fields
            .Item(sch & "sendusing")=2      ' cdoSendUsingPort
            .Item(sch & "smtpserver")="68.162.88.37"
            .Update
      End With
      
      Set mailObj = Server.CreateObject("CDO.Message")
'      mailObj.RemoteHost = "mail-fwd"
'      mailobj.FromName = strSenderName
'      mailobj.FromAddress = strSenderEmail
'      mailObj.ContentType = "text/html"
'      Set mailObj = Server.CreateObject("CDONTS.NewMail")

      Set mailObj.Configuration = cdoConfig
      mailobj.From = strSenderName
            
      strBody = strMsg & mailBreak & mailBreak
      
      strBody = strBody & "This message was sent from the Ardmore Rotary Website on " & FormatDateTime(Now(), vbLongDate) & " by " & strSenderName & "." & mailBreak& mailBreak
      
      strBody = strBody & "<a href=""mailto:" & strSenderEmail & """>" & strSenderEmail & "</a>" & mailBreak & mailBreak
      strBody = strBody & "<a href=""http://www.ardmorerotary.org/"" target=""_blank"">http://www.ardmorerotary.org</a>"
      
      mailobj.Subject = strSubject
      mailobj.TextBody = strBody
'      mailobj.BodyText = strBody
      
      arrSent = arrRecips
      mailTo = ""
            
      For i =0 to uBound(arrRecips,2)      
            If arrRecips(3,i) = True Then
                  intEmail = 1
            Else
                  intEmail = 2
            End If
      
            strEmail = arrRecips(intEmail,i)

            If strEmail <> "" Then
'                  mailObj.AddRecipient arrRecips(0,i), strEmail
                  mailTo = mailTo & strEmail & ";"
                  arrSent(0, i) = arrRecips(0,i)
                  arrSent(1, i) = strEmail
            End If                  
      Next

'      mailObj.SendMail
      mailObj.To = strEmail
      mailObj.Send()
      
      
      set mailObj = nothing
      set cdoConfig = nothing
      
      sendArrayEmail = arrSent
End function
%>
0
dyarosh
Asked:
dyarosh
1 Solution
 
WeaveDaddyCommented:
Is your new web host configured to allow you to use CDO to relay mail through their webserver?  They must have the smtp component configured to allow relay for web applications.  They may be using a component for web app mail rather than allowing CDO.  Check their documentation for form to email.
0
 
OliWarnerCommented:
Yes, lots of hosts dont allow CDO in favour of other mail applications or none at all.

It could also be that they block SMTP being used from any other mail server than their own. This is to make people responsible for spam if they send it.

So 2 thing to ask your new host. 1) Do you support CDO? 2) Is there a specific mailserver I have to use to send mail?
0
 
Samer ChidiacChief Innovation & Strategy OfficerCommented:
if your host is using Windows 2003 .. then the CDO is required when using ASP .. other wise you can use Cdont Mail component ...

but also check your Host with that .. your code looks Fine .. ( i didn't go in depth with it - but it seems ok )

Cheers,

SC

---------------
Samer Chidiac
Microsoft MVP - ASP/ASP.net
0
 
dyaroshAuthor Commented:
I modified the code to use the CDONTS Mail Component and this is the error I receive:

Microsoft VBScript runtime error '800a0046'

Permission denied

C:\WEBSPACE\RESADMIN\DYAROSH\ARDMOREROTARY.ORG\WWW\MANAGE\../includes/sendArrayEmail.asp, line 61


Line 61 is the .Send function.  I don't know what permission it is denying me.  If anyone has any idea please let me know.  I'm getting very frustrated with this problem.
0
 
OliWarnerCommented:
Do as I say in my first post. Ask your host what email they allow and which (if any) SMTP server the mail must go through.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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