943,198 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 260
  • ASP RSS
Sep 2nd, 2010
0

asp send email

Expand Post »
I want to send mail from an asp page. The asp page is called from a html page. The sending mail using CDOSYS and CDO is not working properly. When i call the asp page from html page, the script for sending mail in the asp page is getting displayed while running rather than working of the process which i had mentioned in the script to work.

The attached image file "sendmail.JPG" shows the runtime problem, when the asp file is being called from html file.


HTML Code

ASP Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
  5. <meta name="ProgId" content="FrontPage.Editor.Document">
  6. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  7.  
  8. </head>
  9.  
  10. <body>
  11.  
  12. <form action=sendmail.asp method="POST">
  13. <p><input type="text" name="T1" size="20"></p>
  14. <p><input type="submit" value="Submit" name="B1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  15. <input type="reset" value="Reset" name="B2"></p>
  16. </form>
  17.  
  18. </body>
  19.  
  20. </html>

ASP File "sendmail.asp" code
*****************************

ASP Syntax (Toggle Plain Text)
  1. <html>
  2.  
  3. <head>
  4. <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
  5. <meta name="ProgId" content="FrontPage.Editor.Document">
  6. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  7.  
  8. <%
  9.  
  10. function sendmail()
  11. {
  12.  
  13. Set myMail=CreateObject("CDO.Message")
  14. myMail.Subject="Sending email with CDO"
  15. myMail.From="rksvidhya@yahoo.com"
  16. myMail.To="swornavidhya.mahadevan@gmail.com"
  17. myMail.TextBody="This is a message."
  18.  
  19. myMail.Configuration.Fields.Item _
  20. ("http://schemas.microsoft.com/cdo/configuration/smtsperver") = "smtp.gmail.com";
  21. myMail.Configuration.Fields.Item _
  22. ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465;
  23. myMail.Configuration.Fields.Item _
  24. ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2;
  25. myMail.Configuration.Fields.Item _
  26. ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")= 1;
  27. myMail.Configuration.Fields.Item _
  28. ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = "true";
  29. myMail.Configuration.Fields.Item _
  30. ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "swornavidhya.mahadevan@gmail.com";
  31. myMail.Configuration.Fields.Item _
  32. ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "************"; // My gmail password.
  33. myMail.Configuration.Fields.Update
  34. myMail.Send
  35. set myMail=nothing
  36.  
  37. response.write("<script>alert('Process Successful.')</script>");
  38.  
  39. }
  40. %>
  41. </head>
  42.  
  43. <body>
  44.  
  45. </body>
  46.  
  47. </html>

Kindly help me at the earliest.

M.Sworna Vidhya
Attached Thumbnails
Click image for larger version

Name:	sendmail.JPG
Views:	46
Size:	98.1 KB
ID:	17018  
Reputation Points: 10
Solved Threads: 0
Newbie Poster
swornavidhya_m is offline Offline
12 posts
since May 2010
Sep 2nd, 2010
0
Re: asp send email
According to your image, you link to the local file. Apparantly, your local webserver does not recognize the asp extension. So instead of executing the code it thinks it is html. Check your webserver configuration.
Last edited by pritaeas; Sep 2nd, 2010 at 10:22 am.
Sponsor
Featured Poster
Reputation Points: 546
Solved Threads: 717
Bite my shiny metal ass!
pritaeas is offline Offline
4,143 posts
since Jul 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: Email recipient based on dropdown list selection
Next Thread in ASP Forum Timeline: what is asp.net and mvc





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC