Click here to Skip to main content
15,908,111 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how i can receive mail in asp.net
provide demonstration
Posted

This gets asked so many times a day. Why can't you find the answers already on this forum ? Or the answers you can find with google.

You CAN'T receive mail with ASP.NET, that's not what it is for. You can create a mail server, which can then recieve mail, and you can use ASP.NET to create the code to show what mail has been recieved, that's another question.
 
Share this answer
 
You cannot receive mail with ASP.NET.

You can send it.

Try this...

Dim objEmail as New MailMessage()
      objEmail.To       = txtTo.Text
      objEmail.From     = txtFrom.Text
      objEmail.Cc       = txtCc.Text
      objEmail.Subject  = "Test Email"
      objEmail.Body     = txtName.Text & ", " &txtComments.Text
      objEmail.Priority = MailPriority.High
  'SmtpMail.SmtpServer  = "localhost"
  try
    SmtpMail.Send(EMail)
    Response.Write(Your E-mail has been sent sucessfully - _
                   Thank You)

  catch exc as Exception
    Response.Write("Send failure: " + exc.ToString())
  End Try


You can create a table to fill the variables then use a button as the event to send.


Receiving can only occur in a mail server, however rules can be set so that certain content or senders will forward content and other data to a table that can be picked up and sent to a web page for example.


It is quite easy to find out all you need by clicking Here[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900