Hi All,
I have written a code for sending mail to the users of the same domain, where my site is hosted. The code is working fine with my local IIS server but when I deployed my site to host server, then it creates problem.
below are my code
Const sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort*
.Item(sch & "smtpserver") = "smtp.example.com"
.Item(sch & "smtpserverport") = 25
.Item(sch & "smtpauthenticate") = 1
.Item(sch & "sendusername") = "xxx.xxxxx" 'I have also used like "xx.xxxxx@example.com"
.Item(sch & "sendpassword") = "xxxx" ' This is the password I given for this user
.Item(sch & "smtpconnectiontimeout") = 60
.Update
End With
Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = "xx.xxxxx@example.com"
.To = "yy.yyyyy@example.com"
.Subject = strSub
.TextBody = "Test Mail"
.AddAttachment "c:\a.txt"
.Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing
Problem that I am facing with the above code::
#1. If I use the exactly the same code then it gives me the following error :: error '80040211'
/workingHere/career_thanks.asp, line 180 which is basically at .Send method.
#2. Now if I remove/comment out the following code from the above written code
.Item(sch & "smtpauthenticate") = 1
.Item(sch & "sendusername") = "xxx.xxxxx" 'I have also used like "xx.xxxxx@example.com"
.Item(sch & "sendpassword") = "xxxx" ' This is the password I given for this user
it gives the error
error :: error '8004020e'
/workingHere/career_thanks.asp, line 177 which is also at same place .Send method.
#3. Now if I change the smtpserver as localhost then it does not gives any error but the user does not receive the mail.
#4. If I change the smtpserver as Localhost and change the value of .To field as
ccccc@gmail.com, then it works.
I am not able to figure out, what is the problem and how can I resolve it, so I have a humble request that any one have any idea then Please help me because I have already waste my 4 working day but didn't get any clue. so any response will highly appreciate.
Thank you
Regards
Ashish