locked
asp.net sending email RRS feed

  • Question

  • User1024191908 posted

    I have an asp.net webforms website and I want it to send emails on behalf of me using my email address: anoosh_pm@yahoo.com

    how can I do that?

    Friday, March 2, 2018 1:30 PM

Answers

  • User475983607 posted

    anooshiravan

    I have an asp.net webforms website and I want it to send emails on behalf of me using my email address: anoosh_pm@yahoo.com

    how can I do that?

    The first step is consult your SMTP provider to get your SMTP setting; port, server, username, password.  For there it's a simple matter of populating the SmtpClient as shown in the docs.

    https://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient(v=vs.110).aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 2, 2018 1:47 PM
  • User475983607 posted

    So is there also a way to let the users of my website see their inbox from inside my website?

    It is unlikely that your users will hand over this type of personal and secured information.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 2, 2018 3:16 PM
  • User283571144 posted

    Hi anooshiravan,

    when I looked for my smtp settings for yahoo mail I  also found some setttings for incoming server(POP)

    So is there also a way to let the users of my website see their inbox from inside my website?

    As mgebhard says, each user should set their mail to allow client access to the mail account.

    After user setting completely, you could try to use some third party library to read the mail with user's mail address and password.

    For example, you could use MailKit 

    Code sample as below:

    using System;
    
    using MailKit.Net.Pop3;
    using MailKit;
    using MimeKit;
    
    namespace TestClient {
    	class Program
    	{
    		public static void Main (string[] args)
    		{
    			using (var client = new Pop3Client ()) {
    				// For demo-purposes, accept all SSL certificates (in case the server supports STARTTLS)
    				client.ServerCertificateValidationCallback = (s,c,h,e) => true;
    
    				client.Connect ("pop.friends.com", 110, false);
    
    				client.Authenticate ("joey", "password");
    
    				for (int i = 0; i < client.Count; i++) {
    					var message = client.GetMessage (i);
    					Console.WriteLine ("Subject: {0}", message.Subject);
    				}
    
    				client.Disconnect (true);
    			}
    		}
    	}
    }

    Best Regards,

    Brando

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 5, 2018 2:40 AM

All replies

  • User475983607 posted

    anooshiravan

    I have an asp.net webforms website and I want it to send emails on behalf of me using my email address: anoosh_pm@yahoo.com

    how can I do that?

    The first step is consult your SMTP provider to get your SMTP setting; port, server, username, password.  For there it's a simple matter of populating the SmtpClient as shown in the docs.

    https://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient(v=vs.110).aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 2, 2018 1:47 PM
  • User1024191908 posted

    Yes you're right.

    when I looked for my smtp settings for yahoo mail I  also found some setttings for incoming server(POP)

    So is there also a way to let the users of my website see their inbox from inside my website?

    Friday, March 2, 2018 3:09 PM
  • User475983607 posted

    So is there also a way to let the users of my website see their inbox from inside my website?

    It is unlikely that your users will hand over this type of personal and secured information.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 2, 2018 3:16 PM
  • User283571144 posted

    Hi anooshiravan,

    when I looked for my smtp settings for yahoo mail I  also found some setttings for incoming server(POP)

    So is there also a way to let the users of my website see their inbox from inside my website?

    As mgebhard says, each user should set their mail to allow client access to the mail account.

    After user setting completely, you could try to use some third party library to read the mail with user's mail address and password.

    For example, you could use MailKit 

    Code sample as below:

    using System;
    
    using MailKit.Net.Pop3;
    using MailKit;
    using MimeKit;
    
    namespace TestClient {
    	class Program
    	{
    		public static void Main (string[] args)
    		{
    			using (var client = new Pop3Client ()) {
    				// For demo-purposes, accept all SSL certificates (in case the server supports STARTTLS)
    				client.ServerCertificateValidationCallback = (s,c,h,e) => true;
    
    				client.Connect ("pop.friends.com", 110, false);
    
    				client.Authenticate ("joey", "password");
    
    				for (int i = 0; i < client.Count; i++) {
    					var message = client.GetMessage (i);
    					Console.WriteLine ("Subject: {0}", message.Subject);
    				}
    
    				client.Disconnect (true);
    			}
    		}
    	}
    }

    Best Regards,

    Brando

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 5, 2018 2:40 AM