Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send E-Mail from .ASP

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
0
36
US
I am using ASP to save information to a SQL database<br>this works great. But of course we have to check the database to see if and when any data came it.<br>I would like to have the submit button send an e-mail in addition to saving data to the database.<br><br>Any Idea's???<br>also using Front Page 2000 <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
I suppose these have to be installed on the Server.<br>Our site is hosted by an ISP so we probably can't add anything to it.<br><br>Can I cut out the Front Page WEBBOT code it generates when you create a <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Dear Doug,<br><br>With EMail even if a component is installed on the ISP's server you still need a SMTP server to accept your request. You really need to talk with your ISP about supporting web based email.<br><br>Hope this helps<br>-pete
 
Atleast one email tool will be installed at ur ISP ask him what it is (usually CDONTS) u can then use it to sent mail to whoever you like <br><br>ask ur isp first what it is <br><br>it should be there in the help section <br><br> <p>Unicorn11<br><a href=mailto:webmaster@tripmedia.com>webmaster@tripmedia.com</a><br><a href= > </a><br>Hi there it all likeminded fellows!!!!!!
 
Hey DougP,<br><br>Your ISP will provide some 3rd party component like<br>1.ASPEmail from persists.com<br>2.CDONTS<br>3. or lot of other 3rd party componets<br><br>which your ISP feels good.Your ISP will have a SMTP and a 3rd party component. Talk to him, he will provide you the documentation.<br><br>But if you are looking for ASPEMAIL component from <A HREF=" TARGET="_new"> you have to download the component and check out the help provided, I can tell you DOUGP it is damn easy, you can even do that from Visual Basic, Just install that component and Just start sending Mails<br><br>Bye<br>Varu
 
they are using ASPemail 4.4<br><br>here is a sample of code<br>It works fantastic<br>---------------------------------------<br>&lt;%<br>Set Mail = Server.CreateObject(&quot;Persits.MailSender&quot;)<br>Mail.Host = &quot;smtp.smtp-server.com&quot; ' Specify a valid SMTP server<br>Mail.From = &quot;<A HREF="mailto:sales@veryhotcakes.com">sales@veryhotcakes.com</A>&quot; ' Specify sender's address<br>Mail.FromName = &quot;VeryHotCakes Sales&quot; ' Specify sender's name<br><br>Mail.AddAddress &quot;<A HREF="mailto:andy@andrewscompany.net">andy@andrewscompany.net</A>&quot;, &quot;Andrew Johnson, Jr.&quot;<br>Mail.AddAddress &quot;<A HREF="mailto:paul@paulscompany.com">paul@paulscompany.com</A>&quot; ' Name is optional<br>Mail.AddReplyTo &quot;<A HREF="mailto:info@veryhotcakes.com">info@veryhotcakes.com</A>&quot;<br>Mail.AddAttachment &quot;c:\images\cakes.gif&quot;<br><br>Mail.Subject = &quot;Thanks for ordering our hot cakes!&quot;<br>Mail.Body = &quot;Dear Sir:&quot; & Chr(13) & Chr(10) & _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Thank you for your business.&quot;<br><br>On Error Resume Next<br>Mail.Send<br>If Err &lt;&gt; 0 Then<br>&nbsp;&nbsp;&nbsp;Response.Write &quot;Error encountered: &quot; & Err.Description<br>End If<br>%&gt; <br>---------------------- <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
One little problem.. It won't pass the form text boxes to my e-mail. Here is my code.<br>-----------------------------<br>If Request.ServerVariables(&quot;REQUEST_METHOD&quot;) = &quot;POST&quot; Then<br>If Request.Form(&quot;VTI-GROUP&quot;) = &quot;0&quot; Then<br> Err.Clear<br><br> Set fp_conn =&nbsp;&nbsp;Server.CreateObject(&quot;ADODB.Connection&quot;)<br> FP_DumpError strErrorUrl, &quot;Cannot create connection&quot;<br><br> Set fp_rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)<br> FP_DumpError strErrorUrl, &quot;Cannot create record set&quot;<br><br> fp_conn.Open Application(&quot;BrochureRequest_ConnectionString&quot;)<br> FP_DumpError strErrorUrl, &quot;Cannot open database&quot;<br><br> fp_rs.Open &quot;BrochureRequests&quot;, fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable<br> FP_DumpError strErrorUrl, &quot;Cannot open record set&quot;<br><br> fp_rs.AddNew<br> FP_DumpError strErrorUrl, &quot;Cannot add new record set to the database&quot;<br> Dim arFormFields0(13)<br> Dim arFormDBFields0(13)<br><br> arFormFields0(0) = &quot;FIRSTNAME&quot;<br> arFormDBFields0(0) = &quot;FIRSTNAME&quot;<br> arFormFields0(1) = &quot;TITLE&quot;<br> arFormDBFields0(1) = &quot;TITLE&quot;<br> arFormFields0(2) = &quot;COMPANY&quot;<br> arFormDBFields0(2) = &quot;COMPANY&quot;<br> arFormFields0(3) = &quot;FAX&quot;<br> arFormDBFields0(3) = &quot;FAX&quot;<br> arFormFields0(4) = &quot;ItemRequested&quot;<br> arFormDBFields0(4) = &quot;BrochureType&quot;<br> arFormFields0(5) = &quot;EMAIL&quot;<br> arFormDBFields0(5) = &quot;EMAIL&quot;<br> arFormFields0(6) = &quot;PHONE&quot;<br> arFormDBFields0(6) = &quot;PHONE&quot;<br> arFormFields0(7) = &quot;LASTNAME&quot;<br> arFormDBFields0(7) = &quot;LASTNAME&quot;<br> arFormFields0(8) = &quot;CITY&quot;<br> arFormDBFields0(8) = &quot;CITY&quot;<br> arFormFields0(9) = &quot;ADDRESS&quot;<br> arFormDBFields0(9) = &quot;ADDRESS&quot;<br> arFormFields0(10) = &quot;STATE&quot;<br> arFormDBFields0(10) = &quot;STATE&quot;<br> arFormFields0(11) = &quot;ZIPCODE&quot;<br> arFormDBFields0(11) = &quot;ZIPCODE&quot;<br> arFormFields0(12) = &quot;COUNTRY&quot;<br> arFormDBFields0(12) = &quot;COUNTRY&quot;<br><br>&nbsp;&nbsp;&nbsp;Fname = fp_rs(&quot;FIRSTNAME&quot;)<br>&nbsp;&nbsp;&nbsp;Lname = fp_rs(&quot;LASTNAME&quot;)<br><br> FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0<br><br> If Request.ServerVariables(&quot;REMOTE_HOST&quot;) &lt;&gt; &quot;&quot; Then<br> FP_SaveFieldToDB fp_rs, Request.ServerVariables(&quot;REMOTE_HOST&quot;), &quot;RemoteComputerName&quot;<br> End If<br> If Request.ServerVariables(&quot;HTTP_USER_AGENT&quot;) &lt;&gt; &quot;&quot; Then<br> FP_SaveFieldToDB fp_rs, Request.ServerVariables(&quot;HTTP_USER_AGENT&quot;), &quot;BrowserType&quot;<br> End If<br> FP_SaveFieldToDB fp_rs, Now, &quot;Date&quot;<br> If Request.ServerVariables(&quot;REMOTE_USER&quot;) &lt;&gt; &quot;&quot; Then<br> FP_SaveFieldToDB fp_rs, Request.ServerVariables(&quot;REMOTE_USER&quot;), &quot;UserName&quot;<br> End If<br><br> fp_rs.Update<br> FP_DumpError strErrorUrl, &quot;Cannot update the database&quot;<br><br> fp_rs.Close<br> fp_conn.Close<br><br> Response.Redirect &quot;thankyou.htm&quot;<br><br>End If<br>End If<br><br>%&gt;<br>&lt;% <br> Set Mail = Server.CreateObject(&quot;Persits.MailSender&quot;)<br> Mail.Host = &quot;smtp.ij.net&quot; ' Specify a valid SMTP server<br> Mail.From = &quot;<A HREF="mailto:Webmaster@universal1.com">Webmaster@universal1.com</A>&quot; ' Specify sender's address<br> Mail.FromName = &quot;WEB Site Auto Responder&quot; ' Specify sender's name<br><br> Mail.AddAddress &quot;<A HREF="mailto:dposton@universal1.com">dposton@universal1.com</A>&quot;, &quot;Guru of The WEB&quot;<br> 'Mail.AddReplyTo &quot;<A HREF="mailto:info@veryhotcakes.com">info@veryhotcakes.com</A>&quot;<br> 'Mail.AddAttachment &quot;c:\images\cakes.gif&quot;<br><br> Mail.Subject = &quot;WEB site Brochure Request&quot;<br> msg = &quot;FIRSTNAME&quot; & &quot; &quot; & Fname & Chr(13) & Chr(10)<br> msg = msg & &quot;LASTNAME&quot; & &quot; &quot; & Lname & Chr(13) & Chr(10)<br> Mail.Body = msg <br> On Error Resume Next<br> Mail.Send<br> If Err &lt;&gt; 0 Then<br>&nbsp;&nbsp;&nbsp; Response.Write &quot;Error encountered: &quot; & Err.Description<br> End If<br>%&gt;<br>------------------------------ End of code ------------<br><br><br>results of email:<br>-----------------<br>Received: from [207.22.166.34] by solomon.universal1.com (NTMail 3.02.13) with E<br>SMTP id dposton for &lt;<A HREF="mailto:dposton@universal1.com">dposton@universal1.com</A>&gt;; Wed, 5 Jul 2000 17:24:40 -0400<br>From: &quot;WEB Site Auto Responder&quot; &lt;<A HREF="mailto:Webmaster@universal1.com">Webmaster@universal1.com</A>&gt;<br>To: &quot;Guru of The WEB&quot; &lt;<A HREF="mailto:dposton@universal1.com">dposton@universal1.com</A>&gt;<br>Subject: WEB site Brochure Request<br>Date: Wed, 05 Jul 2000 17:21:28 -0400<br>MIME-Version: 1.0<br>Message-Id: &lt;<A HREF="mailto:21244004685582@universal1.com">21244004685582@universal1.com</A>&gt;<br>&nbsp;<br>FIRSTNAME<br>LASTNAME<br>&nbsp;<br>.<br>----------------<br>First name and Last name are blank in the e-mail, but the data is being saved OK to the database.<br><br>Any ideas????<br><br>TIA <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Hi,<br><br>I did not look at your code since it is too complicated.<br>But here is how you should do:<br><br>Suppose you DB table is &quot;USER&quot; and has three fields<br>1. Name<br>2. email<br>3. address<br><br>Before you write to the DB, you must already have an input form for this. Suppose this file is called &quot;input.htm&quot; which later pass to &quot;write.asp&quot; to save it to DB<br><br>In &quot;write.asp&quot; you should have something like this<br>Dim getname,getemail,getaddress<br>getname=Request.Form(&quot;username&quot;)<br>getemail= Request.Form(&quot;useremail&quot;)<br>getaddress = Request.Form(&quot;useraddress&quot;)<br><br>Suppose the user key in name=a,email=b,address=c then now<br>getname = a<br>getemail = b<br>getaddress=c<br><br>Then you write to database using ADD.NEW<br>RS(&quot;name&quot;) = a<br>RS(&quot;email&quot;) = b<br>RS(&quot;address&quot;) = c<br><br>You current program is still ok at this part.<br><br>Now the email part<br>Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)<br>objMail.From = &quot;<A HREF="mailto:Webmaster@universal1.com">Webmaster@universal1.com</A>&quot;<br>objMail.Subject = &quot;WEB site Brochure Request&quot;<br>objMail.To = getemail<br>objMail.Body = &quot;Here are the information&quot; & vbCrlf & _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Name &quot; & getname & vbCrlf & _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Email&nbsp;&nbsp;&quot; & getemail & vbCrlf & _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Address &quot; & getaddress & vbCrlf & _<br>objMail.Send<br>Set objMail = nothing <br><br>This should work<br><br>Good Luck<br>
 
I am currently working on a project, which has a form E-mailer.<br>The asp code uses CDONTS.dll.<br>When I try to execute the the code, I get the following error.<br><br>Microsoft VBScript runtime error '800a01ad' <br><br>ActiveX component can't create object <br><br>/aspformmail.asp, line 268 <br><br>Teky. <p> <br><a href=mailto: > </a><br><a href= > </a><br>
 
DougP,<br><br>&gt; Any ideas????<br><br>Well just a guess but this is your sequence in psuedo code<br><br>*Recordset AddNew<br>*Setup some array (don't know why)<br>*Store recordset field values into variables FName, LName<br>*Call some procedure named 'FP_SaveFormFields ' which I assume actually places the values into the 'new row'<br>*Create email message using variables FName and LName<br><br>Now it appears to me that you are storing values into FName and LName from a 'new' empty row, just a guess, what do you think?<br><br>-pete
 
I have a related question on using E-Mail in ASP code. If I am running PWS on Windows 98, are there any componnents out there that I can use? CDONTS work only on NT's running IIS.
Any help/suggestion would be appreciated.

Thanks
Sundar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top