Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Sending mail using ASP.

Sending mail using ASP.

Scheduled Pinned Locked Moved Web Development
sysadminwindows-admintutorialquestion
6 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Venkatesh P
    wrote on last edited by
    #1

    Hi, How to send a mail using ASP? I am using windows server 2003. I want to have a form, in which user can enter name,email address and then in the submit button, send the mail. How to achieve this? Thank you

    Thanks & Regards, Venkat

    R 1 Reply Last reply
    0
    • V Venkatesh P

      Hi, How to send a mail using ASP? I am using windows server 2003. I want to have a form, in which user can enter name,email address and then in the submit button, send the mail. How to achieve this? Thank you

      Thanks & Regards, Venkat

      R Offline
      R Offline
      RCoate
      wrote on last edited by
      #2

      Google (or Bing) is your friend! Lots of examples out there. Just search for net.mail example

      V 1 Reply Last reply
      0
      • R RCoate

        Google (or Bing) is your friend! Lots of examples out there. Just search for net.mail example

        V Offline
        V Offline
        Venkatesh P
        wrote on last edited by
        #3

        Hi, I searched that. But I am not getting for using in windows server 2003. I tried the below code:

        <%

        Option Explicit

        dim sName, sEmail, sMessage
        dim oCdoMail, oCdoConf, sConfURL

        if Request.Form("Action") <> "" then
        sName = Request.Form("Name")
        sEmail = Request.Form("Email")
        sMessage = Request.Form("Message")

        	Set oCdoMail = Server.CreateObject("CDO.Message")
        	Set oCdoConf = Server.CreateObject("CDO.Configuration")
        
        	sConfURL = "http://schemas.microsoft.com/cdo/configuration/"
        
        	with oCdoConf
        		.Fields.Item(sConfURL & "sendusing") = 2
        		.Fields.Item(sConfURL & "smtpserver") = "server name"
        		.Fields.Item(sConfURL & "smtpserverport") = 25
        		.Fields.Update
        	end with
        
        	with oCdoMail
        		.From = "you@yourdomain.com"
        		.To = sEmail
        		.Subject = "My message subject"
        		.TextBody = sMessage
        		.HTMLBody = sMessage
        		.Configuration = oCdoConf
        		.Send
        	end with
        
        	Set oCdoConf = Nothing
        	Set oCdoMail = Nothing
        
        response.write "Thanks for your message!"
        

        else
        %>
        <form method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
        <p>Name:<br /><input type="text" name="Name" /></p>
        <p>E-mail:<br /><input type="text" name="Email" /></p>
        <p>Message:<br /><textarea name="Message"></textarea></p>
        <p><input type="submit" name="Action" value="Send" /></p>
        </form>
        <%
        end if
        %>

        But I am not getting the mail in inbox. Any help on this.. Thank you

        Thanks & Regards, Venkat

        modified on Tuesday, March 9, 2010 4:33 AM

        T 1 Reply Last reply
        0
        • V Venkatesh P

          Hi, I searched that. But I am not getting for using in windows server 2003. I tried the below code:

          <%

          Option Explicit

          dim sName, sEmail, sMessage
          dim oCdoMail, oCdoConf, sConfURL

          if Request.Form("Action") <> "" then
          sName = Request.Form("Name")
          sEmail = Request.Form("Email")
          sMessage = Request.Form("Message")

          	Set oCdoMail = Server.CreateObject("CDO.Message")
          	Set oCdoConf = Server.CreateObject("CDO.Configuration")
          
          	sConfURL = "http://schemas.microsoft.com/cdo/configuration/"
          
          	with oCdoConf
          		.Fields.Item(sConfURL & "sendusing") = 2
          		.Fields.Item(sConfURL & "smtpserver") = "server name"
          		.Fields.Item(sConfURL & "smtpserverport") = 25
          		.Fields.Update
          	end with
          
          	with oCdoMail
          		.From = "you@yourdomain.com"
          		.To = sEmail
          		.Subject = "My message subject"
          		.TextBody = sMessage
          		.HTMLBody = sMessage
          		.Configuration = oCdoConf
          		.Send
          	end with
          
          	Set oCdoConf = Nothing
          	Set oCdoMail = Nothing
          
          response.write "Thanks for your message!"
          

          else
          %>
          <form method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
          <p>Name:<br /><input type="text" name="Name" /></p>
          <p>E-mail:<br /><input type="text" name="Email" /></p>
          <p>Message:<br /><textarea name="Message"></textarea></p>
          <p><input type="submit" name="Action" value="Send" /></p>
          </form>
          <%
          end if
          %>

          But I am not getting the mail in inbox. Any help on this.. Thank you

          Thanks & Regards, Venkat

          modified on Tuesday, March 9, 2010 4:33 AM

          T Offline
          T Offline
          T M Gray
          wrote on last edited by
          #4

          What do the logs on the SMTP server say? I assume where it says "server name" you actually have the name of your server correct? Are you getting any error messages?

          D 1 Reply Last reply
          0
          • T T M Gray

            What do the logs on the SMTP server say? I assume where it says "server name" you actually have the name of your server correct? Are you getting any error messages?

            D Offline
            D Offline
            DX Roster
            wrote on last edited by
            #5

            no sir it will not give a error because in this we have to define mail protocol name.. we can define SMTP,POP, etc.. but when we want to send mail not store then we can use SMTP protocol if we want to send mail as well as store then we use POP protocol.. so SMTP is not a server name its a type of protocol.. If You Get your answer then please Rating me... Thanks.. "Are You Ready" DX-ARMY

            T 1 Reply Last reply
            0
            • D DX Roster

              no sir it will not give a error because in this we have to define mail protocol name.. we can define SMTP,POP, etc.. but when we want to send mail not store then we can use SMTP protocol if we want to send mail as well as store then we use POP protocol.. so SMTP is not a server name its a type of protocol.. If You Get your answer then please Rating me... Thanks.. "Are You Ready" DX-ARMY

              T Offline
              T Offline
              T M Gray
              wrote on last edited by
              #6

              I don't think you understand. You can't use the POP protocol to send mail. To send mail you need to have an SMTP server. That server has a name. In the original poster's code he has the words "server name" as the name of the SMTP server. That would not be a valid server name. Before you try to correct someone, make sure you understand what they said.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups