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

smpt email server does not deliver email from the form

I have the following routing in my email.asp,
which does not produce any error,
ends up with   "Your message has been sent"
Yet no mail delivered!

please, tell me what's wrong

-------------------------------------------------------------------------------------
<%
Dim strTo, strSubject, strBody, strFrom, blnHTML,sMailServer
Dim objCDOMail 'The CDO object

strFrom = Request.Form("from")
strSubject = Request.Form("subject")
strBody = Request.Form("message")
blnHTML = ""
sMailServer = "mail.mydomain.com"

Set Mail=Server.CreateObject("CDO.Message")

Sub SendMailCDOSYS(strFrom,strTo,strSubject,strBody,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") = "mail.mydomain.com"
            .Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")= 1
            .Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") =  "postmaster@mydomain.com"
            .Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"
            .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 = "postmaster@mydomain.com"
          .sMailServer = "mail.mydomain.com"        
          ' ** THE SUBJECT OF THE E-MAIL **
          .Subject = strSubject
          .TextBody = strBody
          .blnHTML = ""
          ' ** SEND THE E-MAIL **
          .Send
     End with                    
       
     ' ** CLOSE THE SERVER MAIL OBJECT **
     Set objCDOSYS = Nothing
End Sub
Response.Write( "Your message has been sent")
%>
0
khlauster
Asked:
khlauster
  • 2
1 Solution
 
aflockhartCommented:
It doesn't produce any error, because you have included this line:
On Error Resume Next

If you remove it, you may see where the process is failing.

You also never actually call the SendMailCDOSYS routine.  You define it but never use it.



0
 
NorushCommented:
If you remove the following line you will get the errormessage explaining what is going on
So remove the following line and run your code again:

on error resume next
0
 
khlausterAuthor Commented:
I uncommented
 on error resume next,
added
Call SendMailCDOSYS(strFrom,strTo,strSubject,strBody,blnHTML,sMailServer)
and Now I got

Access is denied.
on line where .Send

hmm..
0
 
khlausterAuthor Commented:
And it is host suggested routine they have in a similar code samples for Asp1.1
Now I am puzzled who is denied an access to my own mail:

Microsoft:
Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"

or Host:
.Send

:)  
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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