468,544 Members | 1,820 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,544 developers. It's quick & easy.

How to auto send an email using asp classic.

Hi Everyone,

I'm just a beginner on asp, just want to ask for the help on how I could do to have a auto email send on my program. Just please give me some basic codes like if the user click OK then it will automatic send a email to specific email address with subject "thank you" and body text "please reply"

thank you in advance for the help

RJ
Oct 11 '09 #1
5 6467
Hi in additon i did this but the problem is i did not received the email. please help. thanks
Expand|Select|Wrap|Line Numbers
  1. Dim myMail
  2.  
  3. Set myMail=CreateObject("CDO.Message")
  4.  
  5. myMail.Subject="Sending email with E2E"
  6. myMail.From="mymail1@ab.com.ph"
  7. myMail.To="mymail@ab.com.ph"
  8. myMail.TextBody="This is a message."
  9. myMail.Send
  10. set myMail=nothing
Oct 11 '09 #2
CroCrew
564 Expert 512MB
Hello rjlorenzo,

Here is a one page example that you can use/tweak.


Page is called: ThisPage.asp

Expand|Select|Wrap|Line Numbers
  1. <% 
  2.     If (Request.Form("xSendMessage")) Then 
  3.         Set myMail=CreateObject("CDO.Message") 
  4.         myMail.Subject = Request.Form("xSubject") 
  5.         myMail.From = "Billy@billy.com" 'Place an email address here so when someone replies to this email you will get it. 
  6.         myMail.To = Request.Form("xEmail") 
  7.         myMail.TextBody = Request.Form("xMessage") 
  8.  
  9.         On Error Resume Next  
  10.            myMail.Send     
  11.            If Err <> 0 Then  
  12.               Response.Write("<h3><Font Color='#FF0000'>Error occurred: <i>" & Err.Description & "</i></Font></h3>") 
  13.            else 
  14.               Response.Write("Your message was sent successfully.") 
  15.            End If 
  16.     End If 
  17. %> 
  18. <html> 
  19.     <head> 
  20.         <title>Example</title> 
  21.     </head> 
  22.     <body> 
  23.         <form method="post" action="ThisPage.asp" name="xForm" id="xForm"> 
  24.             <input type="hidden" name="xSendMessage" value="true"> 
  25.             Full Name: <input type="text" name="xName" size="50"><br> 
  26.             Email: <input type="text" name="xEmail" size="50"><br> 
  27.             Subject: <input type="text" name="xSubject" size="50"><br> 
  28.             Message: <textarea name="xMessage" cols="50" rows="5"></textarea><br> 
  29.             <input type="submit" value="submit"> 
  30.         </form> 
  31.     </body> 
  32. </html> 
  33.  
If you get an error this should tell you why.


Hope this helps,
CroCrew~
Oct 12 '09 #3
Hi thanks you for reply, still didn't recieved the mail and no error message or successful message display. see my complete code below.
Expand|Select|Wrap|Line Numbers
  1. if grp <> act_stage then
  2.  
  3. Dim myMail
  4. Set myMail=CreateObject("CDO.Message")  
  5.         myMail.Subject = "testing auto email"  
  6.         myMail.From = "ab@xxx.com.ph"   
  7.         myMail.To = "cd@xxx.com.ph"  
  8.         myMail.TextBody = " e2e TMS auto email testing if stage to other group"
  9.  
  10.         On Error Resume Next   
  11.            myMail.Send      
  12.            If Err <> 0 Then   
  13.               Response.Write("<h3><Font Color='#FF0000'>Error occurred: <i>" & Err.Description & "</i></Font></h3>")  
  14.            else  
  15.               Response.Write("Your message was sent successfully.")  
  16.            End If  
  17.  
  18. set myMail=nothing
  19. end if
  20.  
  21. response.redirect ("prs_editrec.asp?user="&user&"&recnum="&recnum)
Oct 15 '09 #4
CroCrew
564 Expert 512MB
It could be that your ISP is blocking the email. Also, check your spam folder.

CroCrew~
Oct 15 '09 #5
gcube
17
Try changing line 4 to:

Expand|Select|Wrap|Line Numbers
  1. Set myMail = CreateObject("CDONTS.Newmail")
  2.  
Oct 20 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

20 posts views Thread by Vijay Kumar R. Zanvar | last post: by
15 posts views Thread by cj | last post: by
10 posts views Thread by Des | last post: by
2 posts views Thread by Boki | last post: by
6 posts views Thread by Peter | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.