how to send mail from my c# windows application [modified]
-
hi everyone,i'm trying to develop an application to send an e-mail from my c# windows application here i'm tis namespace using System.Net.Mail; and its my code::::: :confused: private void button1_Click(object sender, EventArgs e) { try { SmtpClient client = new SmtpClient("192.168.1.15", 808); MailAddress from = new MailAddress("a@live.com"); MailAddress to = new MailAddress("d@live.com"); MailMessage mail = new MailMessage(from,to); mail.Body = textBox1.Text; mail.Subject = " hi da "; client.Send(mail); } catch (SystemException se) { MessageBox.Show(se.ToString()); } finally { } -------------------------------------------------- this is ma code but its work but i'm getting run time error like " failure sending mail, unable to connect to remote server" in smtpclient class i have given ip address as my host and port id..... pls help me to resolve tis error
modified on Friday, April 16, 2010 4:23 AM
-
hi everyone,i'm trying to develop an application to send an e-mail from my c# windows application here i'm tis namespace using System.Net.Mail; and its my code::::: :confused: private void button1_Click(object sender, EventArgs e) { try { SmtpClient client = new SmtpClient("192.168.1.15", 808); MailAddress from = new MailAddress("a@live.com"); MailAddress to = new MailAddress("d@live.com"); MailMessage mail = new MailMessage(from,to); mail.Body = textBox1.Text; mail.Subject = " hi da "; client.Send(mail); } catch (SystemException se) { MessageBox.Show(se.ToString()); } finally { } -------------------------------------------------- this is ma code but its work but i'm getting run time error like " failure sending mail, unable to connect to remote server" in smtpclient class i have given ip address as my host and port id..... pls help me to resolve tis error
modified on Friday, April 16, 2010 4:23 AM
Do you have an smtp server running at 192.168.1.15:808 ? probably not. You should use the smtp relay host that your isp has given you. (use the fqdn, not the ip-address) If you don't have mail at an isp, this won't work. (live.com does not provide smtp relay services). Also, your isp may limit the from: address, and may require authentication when sending mail.
-
Do you have an smtp server running at 192.168.1.15:808 ? probably not. You should use the smtp relay host that your isp has given you. (use the fqdn, not the ip-address) If you don't have mail at an isp, this won't work. (live.com does not provide smtp relay services). Also, your isp may limit the from: address, and may require authentication when sending mail.
hi their,u have told me to use fqdn instead of smtp class n also u have mentioned tat "live.com does not provide smtp relay services" then which mail portal does support to send mails without any limitation or minimum limitation... how do i find fqdn....? could u give the exact coding to accomplish my task?
-
hi their,u have told me to use fqdn instead of smtp class n also u have mentioned tat "live.com does not provide smtp relay services" then which mail portal does support to send mails without any limitation or minimum limitation... how do i find fqdn....? could u give the exact coding to accomplish my task?
fqdn means fully qualified domain name. Try Google if you don't understand a word. What you're looking for is an 'open smtp relay' (look it up before replying). Technically not illegal, but if you find one, your mail will probably be blocked by the recipient's ISP. Are you trying to get into the spam business? You will have to set up your own smtp server if you want to send mail without limitations, but if you start spamming, expect 1) Your Internet account to be closed down by your ISP 2) If you're really good at it, a visit from the Feds. (CAN-SPAM act of 2003). If your intentions are pure, have a look at this list: http://www.iopus.com/guides/bestpopsmtp.htm[^]
-
fqdn means fully qualified domain name. Try Google if you don't understand a word. What you're looking for is an 'open smtp relay' (look it up before replying). Technically not illegal, but if you find one, your mail will probably be blocked by the recipient's ISP. Are you trying to get into the spam business? You will have to set up your own smtp server if you want to send mail without limitations, but if you start spamming, expect 1) Your Internet account to be closed down by your ISP 2) If you're really good at it, a visit from the Feds. (CAN-SPAM act of 2003). If your intentions are pure, have a look at this list: http://www.iopus.com/guides/bestpopsmtp.htm[^]
i saw about fqdn in google ... but my aim is not to get into spam business...its just for my learning only actually i wanna to develop a application just like outlook n i'm student so i'm wanna to learn it. i wan code for my gmail account....once if i go through tat sample code then i ll become much clear...could u post any sample code?if yes pls post it soon because i'm eager to learn it
-
i saw about fqdn in google ... but my aim is not to get into spam business...its just for my learning only actually i wanna to develop a application just like outlook n i'm student so i'm wanna to learn it. i wan code for my gmail account....once if i go through tat sample code then i ll become much clear...could u post any sample code?if yes pls post it soon because i'm eager to learn it
-
:-D hey thanks friend... its works now..now i realized my problem.. actually i was sending from firewall enabled machine ..after i gone through tat code n its commands i turn off my proxy n i sent mail then i worked ...once again tanks michal:thumbsup:
-
i was working in proxy enabled machine.after i turn off it then it works but again i got different run time error n the exception was "smtp requires secure connection or client was not authenticated".it sent few failure notice to my mail id. pls help me to resolve tis problem:confused:
-
i was working in proxy enabled machine.after i turn off it then it works but again i got different run time error n the exception was "smtp requires secure connection or client was not authenticated".it sent few failure notice to my mail id. pls help me to resolve tis problem:confused:
You will probably have to turn on SSL (secure sockets layer) to get access to server. Turn on the EnableSsl property of your SmtpClient object. You may also have to select another port to send on. Talk to whoever is administering the smtp server, or read any documentation for this smtp server. If you already can send mail through this server, from another program (outlook, or windows mail, or whatever), lookup the connection parameters in that program. Here is full example of mail client that uses SSL: http://www.codeproject.com/Articles/66257/Sending-Mails-in-NET-Framework.aspx[^]