473,411 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

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 6752
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

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

Similar topics

20
by: Vijay Kumar R. Zanvar | last post by:
Hello, Unlike register, auto keyword can not be used to declare formal parameter(s). Is there any specific reason for this? Kind regards, Vijay Kumar R. Zanvar
21
by: Dino M. Buljubasic | last post by:
I'd like my application to be able to detect default email application (MS Outlook or whichever is set to be default) so that the user can enter the email body, address, subject line and send the...
5
by: Paulovič Michal | last post by:
hi all, I have problem with SERIAL field type (or sequence functionality). I have table with three columns - ID, IDS, NAME. I want auto-increment IDS grouped by ID. Example: 1, 1, Ferdo 1, 2,...
15
by: cj | last post by:
How can I get a button in VB to send the contents of a text box via email in a manner similar to the "Send To\Mail Recipient" functionality that you can select via right clicking a file in Windows...
17
by: Liam.M | last post by:
Hey guys, Forgive me if my question my be alittle silly, but I would very much appreciate and assistance that could be given! My situation is as follows: I have created a Button, and set...
10
by: Des | last post by:
I was wondering if anyone could help me out with this. I use Access 2003 to generate certain files and then I convert them to pdf, I was wondering if anyone would know the code I could use where I...
2
by: Boki | last post by:
Hi All, I want to create a program that auto send out email ( not email bomb ) to myself. I tried the MAPI, but it will show a notiifcation message, user need to confirm that. My target is...
3
by: TS | last post by:
I am using IE 7. I have a website running on my local machine (localhost) and auto complete doesnt work for any of the textboxes, but going to web sites on the internet does support this so i know...
6
by: Peter | last post by:
I have a APS.NET 3.5 webpage which calls a web service. What I need is to update this page automatically when a value changes in the webservice, does anyone have an example? Thank You ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.