views:

250

answers:

3
Set objCDOSYSMail = Server.CreateObject("CDO.Message") 
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

Set Flds = objCDOSYSCon.Fields
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "any mail"
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "any password"
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "any server"
Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")  = 25
Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1

Flds.update

Set objCDOSYSMail.Configuration = objCDOSYSCon 

objCDOSYSMail.From = "any mail"
objCDOSYSMail.To = "any mailid"
'' // objCDOSYSMail.CC = "any mailid"
objCDOSYSMail.Bcc = "any mailid"    
objCDOSYSMail.Subject = "feed back"      
objCDOSYSMail.HTMLBody = strBody

objCDOSYSMail.Send

Set objCDOSYSMail = Nothing

'' // Response.redirect("thank.html")
response.Write("saved")
+3  A: 

Change

Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1

to

Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

1 - is seinding via a pickup directory 2 - is sending via SMTP

Looking at your other parameters you are obviously trying to send via port 25.

DmitryK
+1  A: 

Try this


    Dim objCDOSYSMail
    Dim objCDOSYSCon
    Dim Flds

    Set objCDOSYSMail = Server.CreateObject("CDO.Message") 
    Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration") 
    Set Flds = objCDOSYSCon.Fields

    With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "any server"

    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")  = 25

    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "any mail"

    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "any password"

    .Update

    End With

    Set objCDOSYSMail.Configuration = objCDOSYSCon 

    'Sending The Email
    With objCDOSYSMail
    .From = "any mail"
        .To = "any mailid"
        .Subject = "feed back"                                             
        .HTMLBody = "my Message"
        .Send

    End With

    'Disposing Objects

    Set objCDOSYSMail = Nothing
    Set objCDOSYSCon = Nothing
    Set Flds = Nothing

If you don't get any error, check the error log on the server. Make sure that the server can relay email to the email server (smtpserver). This can be done by performing a quick "TELNET Session" from the webserver to the email server. Some SMTP Servers perform a reverse DNS on the senders domain as well. This might sound stupid, but check the username and password as well.

NOTE: Your question was voted down because you did not specify clearly your intention. Next time be "SPECIFIC" and not "PACIFIC" (like the big sea). Most of the people hanging out here are either professionals or trying to be, so at least try to be one.

Saif Khan
and also don't ask and hide.Seems like a pattern looking at your question history.
krishna
A: 

You might wanna use the open source library ajaxed for that. It detects the component and you dont need to worry about that.

Forget the problem of choosing the right email component (installing & configuring it). ajaxed does that for you. It checks which components are installed on the server and uses the "best" one. Please refer to the API to see which components are currently supported. As this page been written Jmail, ASPEmail and CDOSYS was supported.

Here is a tutorial on how to send an email.

Michal