Sunday, August 2, 2009

Is there a way to send an email using C# without setting a SMTP Client?

I’m using .NET 2.0, and I want to send an email using C#. I am using the namespace System.Net.Mail to send email, but as far as I can tell it requiers you to use a SMTP Client. What I need to know is, is there a way to send an email without seting a SMTP Client? I could do this with PHP, but I don’t see how to do it in C#.

Is there a way to send an email using C# without setting a SMTP Client?
Hi,





You NEED an SMTP server to send email regardless of the programming/scripting language. The Send Mail Transport Protocol is the standard used for sending email across the internet.





The reason why this would work in PHP is because the SMTP server is already set on that machine, look at the php.ini and you will see all info. Most server operating systems has an SMTP server set by default, that is why your PHP works. Your webhost already set the SMTP server on your box.





For .NET, most hosts (if your doing web applications) have that already installed, but if your doing a normal application, then you have have an SMTP server to send the email. Usually, programmers supply an option in the program so the user can change the SMTP information so that the program could work. I usually allow the user add his email SMTP information into the settings of the program so that he/she could use the email features.





Good Luck


No comments:

Post a Comment