asp classic - Error email send using gmail smtp server with CDOSYS -


i have error on asp page

error '80040211' /contact_us1.asp, line 106

line 106 objsendmail.send method call. bellow code whole sending email through cdosys , without smtp server installed.

os - windows server2008r2, iis - 7.5

<%@language="vbscript" codepage="65001"%> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">  <% 'declaring variables dim smtpserver,youremail,yourpassword,contactus_name,contactus_tel,contactus_email dim contactus_subject,contactus_body,action,iserror   ' edit these 3 values accordingly.. leave smtp server alone set gmail smtpserver = "smtp.gmail.com" youremail = "someone@gmail.com" yourpassword = "--------"    ' grabbing variables form post contactus_name = request("contactus_name") contactus_tel = request("contactus_tel") contactus_email = request("contactus_email") contactus_subject = request("contactus_subject") contactus_body = request("contactus_body") action = request("action")  ' used check email entered in valid format function isvalidemail(email)     dim validflag,badflag,atcount,atloop,specialflag,username,domainname,atchr,tary1     validflag = false         if (email <> "") , (instr(1, email, "@") > 0) , (instr(1, email, ".") > 0)             atcount = 0             specialflag = false             atloop = 1 len(email)             atchr = mid(email, atloop, 1)                 if atchr = "@" atcount = atcount + 1                 if (atchr >= chr(32)) , (atchr <= chr(44)) specialflag = true                 if (atchr = chr(47)) or (atchr = chr(96)) or (atchr >= chr(123)) specialflag = true                 if (atchr >= chr(58)) , (atchr <= chr(63)) specialflag = true                 if (atchr >= chr(91)) , (atchr <= chr(94)) specialflag = true             next             if (atcount = 1) , (specialflag = false)                 badflag = false                 tary1 = split(email, "@")                 username = tary1(0)                 domainname = tary1(1)             if (username = "") or (domainname = "") badflag = true             if mid(domainname, 1, 1) = "." badflag = true             if mid(domainname, len(domainname), 1) = "." badflag = true                 validflag = true             end if         end if         if badflag = true validflag = false         isvalidemail = validflag end function %> <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head>  <body class="onecolfixctrhdr" onload="p7_initpm(0,0,1,-20,10)">  <% ' if there no input errors , action of form "sendemail" send email off if action = "sendemail"      dim strbody      ' here create nice looking html body email     strbody = strbody & "<font face=""arial"">contact form submitted @ " & now() &  vbcrlf & "<br><br>" '   strbody = strbody & "from http://" & request.servervariables("http_host") &  vbcrlf & "<br>" '   strbody = strbody & "ip " & request.servervariables("remote_addr") & vbcrlf & "<br>"     strbody = strbody & "name" & " : " & " " & replace(contactus_name,vbcr,"<br>") & "<br>"     strbody = strbody & "tel." & " : " & " " & replace(contactus_tel,vbcr,"<br>") & "<br>"     strbody = strbody & "email" & " : " & " " & replace(contactus_email,vbcr,"<br>") & "<br>"     strbody = strbody & "subject" & " : " & " " & replace(contactus_subject,vbcr,"<br>") & "<br>"     strbody = strbody & "<br>" & replace(contactus_body,vbcr,"<br>") & "<br>"     strbody = strbody & "</font>"      dim objsendmail     set objsendmail = createobject("cdo.message")       'this section provides configuration information remote smtp server.      objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'send message using network (smtp on network).     objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"     objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465      objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1 'use ssl connection     objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60      objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication     objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "someone@gmail.com"     objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "----------"      objsendmail.configuration.fields.update      'end remote smtp server configuration section==      objsendmail.to = youremail     objsendmail.cc = "karapetyan.manuk@gmail.com;kmanuk@mail.ru"     objsendmail.subject = contactus_subject     objsendmail.from = contactus_email      ' sending html email.. switch comments around send text email instead     objsendmail.htmlbody = strbody     'objsendmail.textbody = strbody      objsendmail.send      set objsendmail = nothing   ' change success messages below or whatever ' response.redirect or offer hyperlink somewhere.. etc etc %> <font size="12">message uxarkvec barehajox</font> <%  else  %>             <form action="contact_us1.asp" method="post">                 <input type="hidden" name="action" value="sendemail">                     <table border="0" cellspacing="1" style="font-size:14px; font-family:verdana, geneva, sans-serif;">                         <tr>                             <td valign="top">                                 full name:                             </td>                         </tr>                         <tr>                             <td colspan="2">                                 <input type="text" name="contactus_name" size="35" value="<% =contactus_name %>" required>                             </td>                         </tr>                         <tr>                             <td valign="top">                                 tel.:                             </td>                         </tr>                         <tr>                             <td colspan="2">                                 <input type="text" name="contactus_tel" size="35" value="<% =contactus_tel %>">                             </td>                         </tr>                         <tr>                             <td valign="top">                                 email:                             </td>                         </tr>                         <tr>                                 <td colspan="2">                                 <input type="text" name="contactus_email" size="35" value="<% =contactus_email %>" required>                             </td>                         </tr>                         <tr>                             <td valign="top">                                 subject:                             </td>                         </tr>                         <tr>                             <td colspan="2">                                 <input type="text" name="contactus_subject" value="<% =contactus_subject %>" size="35">                             </td>                         </tr>                         <tr>                             <td valign="top">                                 message:                             </td>                         </tr>                         <tr>                             <td valign="top">                                 <textarea  cols="60" name="contactus_body" wrap="soft" style="resize:none; height: 150px" required><% =contactus_body %></textarea>                             </td>                         </tr>                         <tr>                             <td colspan="2">                                 <input type="submit" value="send message" style="font-size:16px">                             </td>                         </tr>                     </table>                 </form>  <%  end if  %>  </body> </html> 

help me resolve issue please.

<html> <head> </head> <body>  <br> start   <% dim smtpserver, youremail, yourpassword smtpserver = "smtp.gmail.com" youremail = "yyyy@gmail.com" yourpassword = "xxxxx"   dim objsendmail set objsendmail = createobject("cdo.configuration") set objsendmsg =  createobject ("cdo.message")  objsendmail.fields ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2  objsendmail.fields ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver objsendmail.fields ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 objsendmail.fields ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true 'use ssl connection objsendmail.fields ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") =60 objsendmail.fields ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication objsendmail.fields ("http://schemas.microsoft.com/cdo/configuration/sendusername") = youremail objsendmail.fields ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = yourpassword objsendmail.fields.update set objsendmsg.configuration = objsendmail    objsendmsg.to = youremail 'objsendmail.cc = "cccccc.dddddd@sunarctechnologies.com" objsendmsg.subject = "auto mail aspsubject" objsendmsg.from = youremail objsendmsg.htmlbody = "<p>hello</p>" objsendmsg.send response.write "mail sent successfully!<br />check inbox for: " set objsendmail = nothing  set objsendmsg = nothing  %>    </body>  </html> above programme giving same error please 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -