Send Mail without IIS
-
Hi, You don't need IIS for sending emails. What you need is to connect to an SMTP (simple mail transfer protocol) server. Here's a sample: ... using System.Net.Mail; ... public bool SendEmail(ref string errMsg) { errMsg = ""; bool res = false; MailMessage msg = new MailMessage("fromemail@someserver.com", "toemail@someserver.com", "This is the subject", "This is the email body..."); msg.IsBodyHtml = false; SmtpClient client = new SmtpClient("smtp.someserver.com", 25); // the address and port of the SMTP server client.Credentials = new System.Net.NetworkCredential("username", "password"); // user name and password to the SMTP server try { client.Send(msg); res = true; } catch (Exception e) { errMsg = e.Message; res = false; } return res; }
-
Hi, You don't need IIS for sending emails. What you need is to connect to an SMTP (simple mail transfer protocol) server. Here's a sample: ... using System.Net.Mail; ... public bool SendEmail(ref string errMsg) { errMsg = ""; bool res = false; MailMessage msg = new MailMessage("fromemail@someserver.com", "toemail@someserver.com", "This is the subject", "This is the email body..."); msg.IsBodyHtml = false; SmtpClient client = new SmtpClient("smtp.someserver.com", 25); // the address and port of the SMTP server client.Credentials = new System.Net.NetworkCredential("username", "password"); // user name and password to the SMTP server try { client.Send(msg); res = true; } catch (Exception e) { errMsg = e.Message; res = false; } return res; }
lackonagy wrote:
You don't need IIS for sending emails. What you need is to connect to an SMTP (simple mail transfer protocol) server.
How would I Install SMTP with out IIS ?
cheers, Abhijit CodeProject.Com MVP
-
If you don't want to use IIS for sending main, then the replacement is Database. You can send mail over Internet using SQL Server. DB: Master Procedure: xp_sendmail
Amandeep Singh Bhullar wrote:
You can send mail over Internet using SQL Server. DB: Master Procedure: xp_sendmail
Amandeep, that great can you have more resource means any links on that ? please share with me. Thanks in advance !!
cheers, Abhijit CodeProject.Com MVP
-
Amandeep Singh Bhullar wrote:
You can send mail over Internet using SQL Server. DB: Master Procedure: xp_sendmail
Amandeep, that great can you have more resource means any links on that ? please share with me. Thanks in advance !!
cheers, Abhijit CodeProject.Com MVP
In our organization we have xp_sendmail stored procedure in MS SQL Server. Details of this are in MSDN http://msdn.microsoft.com/en-us/library/ms189505.aspx
-
In our organization we have xp_sendmail stored procedure in MS SQL Server. Details of this are in MSDN http://msdn.microsoft.com/en-us/library/ms189505.aspx
Thanks :)
cheers, Abhijit CodeProject.Com MVP
-
If you don't have IIS installed, then you can't run ASP.NET, so why are you asking here ? Sending mail does not require IIS, it requires a mail server to send through, which IIS by default, is not. I don't know what these other people are telling you.
Christian Graus Driven to the arms of OSX by Vista.
-
Not possible.. when install IIS on your server there is option of SMTP server that is fully responsible for mail transfer. even if you are able to third party tool for the SMTP server then is is possible..
Anshuman Singh
Anshumas wrote:
Not possible..
:) that's why I asked that personthat how he will install SMTP with out IIS ? :laugh:
cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net
-
Anshumas wrote:
Not possible..
:) that's why I asked that personthat how he will install SMTP with out IIS ? :laugh:
cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net
you do not need laugh... the question is how to send mail without iis, may you can host your site on linux server there is no need of web server http://atmail.com/linux-email-server/?gclid=CL6AlZ_kipgCFZEwpAodbj654Q[^] every developer is very known about smtp is one server of IIS. it can not run without IIS. so be mature.:mad:
Anshuman Singh