Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

receive email through asp.net application

I want to receive email to my email address through my asp.net application. Its like someone who send an inquiry through a form. I have used the following code for this and seems like its doing nothing. I remember that I did one of my websites and cant remember how I did it. Please find the code below.

Thanks,

eMessage.To = "[email protected]"
        eMessage.From = txtEmail.Text
        eMessage.Subject = "Web Submission"
        eMessage.Body = "Web submission received from " & txtName.Text & ". Phone no: " & txtPhone.Text & "."
        eMessage.Priority = MailPriority.High
        SmtpMail.Send(eMessage)

How can I make this working?

like image 861
Joshua Avatar asked Mar 04 '26 18:03

Joshua


1 Answers

Your sample code shows how to use SMTP to send emails, but you won't be able to retrieve emails from a remote server using this protocol.

The two most common protocols used to retrieve emails are POP3 and IMAP4, and unfortunately the .NET framework doesn't provide an implementation of them like it is done with SMTP.

One option for email retrieval is to use use the open source POP3 client OpenPop.NET, which is discussed in this SO question: retrieve email using c#?.

like image 105
Thomas C. G. de Vilhena Avatar answered Mar 06 '26 20:03

Thomas C. G. de Vilhena



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!