| | |
sending email
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
Hi all
I have been trying to send email from my asp.net website using c#. the code runs without any errors, but when i click the send button i get this error.
/*System.Net.Mail.SmtpException: Failure sending mail.---> System.Net.WebException: Unable to connect to remote server -->System.net.sockets.socketException: a connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.EndConnect(IAsyscResult asyncResult)*/
------------------------------------------------------------------
I heard that McAffee OAS blocks emails from going out but i have disabled it in my computer. Can you please help in eliminating this error.
I have been trying to send email from my asp.net website using c#. the code runs without any errors, but when i click the send button i get this error.
/*System.Net.Mail.SmtpException: Failure sending mail.---> System.Net.WebException: Unable to connect to remote server -->System.net.sockets.socketException: a connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.EndConnect(IAsyscResult asyncResult)*/
------------------------------------------------------------------
I heard that McAffee OAS blocks emails from going out but i have disabled it in my computer. Can you please help in eliminating this error.
•
•
Join Date: May 2007
Posts: 18
Reputation:
Solved Threads: 1
Check, if your mail client is created in this way ?
System.Net.Mail.SmtpClient mailClient = new SmtpClient("your.smtp.server", 25);
System.Net.NetworkCredential nc = new System.Net.NetworkCredential("YourLogin", "YourPassword");
mailClient.Credentials = nc;
And also check address of your SMTP server, login and password, if they are all correct. Or there may be also problems at server side.
System.Net.Mail.SmtpClient mailClient = new SmtpClient("your.smtp.server", 25);
System.Net.NetworkCredential nc = new System.Net.NetworkCredential("YourLogin", "YourPassword");
mailClient.Credentials = nc;
And also check address of your SMTP server, login and password, if they are all correct. Or there may be also problems at server side.
here is the code i used
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.To.Add(emailAddTextBox.Text); message.Subject = "Testing"; message.From = new System.Net.Mail.MailAddress("myusername@gmail.com"); message.Body = "Just Testing"; System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com",25); SmtpClient client = new SmtpClient(); smtp.Credentials = new System.Net.NetworkCredential("myusername", "mypassword"); smtp.Port = 587; smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; try { smtp.Send(message); } catch (Exception exmail) { flightNameLabel.Text = "The email cannot be sent" + exmail.ToString(); }
![]() |
Similar Threads
- Sending email from a shell script (Shell Scripting)
- Sending HTML/Plain text Emails (PHP)
- Sending HTML email via PHP mail function (PHP)
- ASP: Sending a HTML form to an email address (ASP)
- Sending email from c++ application (C++)
- Need help on sending email with image and text (Growing an Online Community)
- CDONTS email goes directly to Badmail folder (ASP)
- email mail deliver error?? virus? (Windows NT / 2000 / XP)
Other Threads in the ASP.NET Forum
- Previous Thread: How to Include framework with st up project
- Next Thread: Connection to database
| Thread Tools | Search this Thread |
.net 3.5 ajax alltypeofvideos appliances asp asp.net bc30451 beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions control countryselector dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol expose fileuploader fill findcontrol flash formatdecimal formview gridview gudi iis javascript list listbox login microsoft mouse mssql nameisnotdeclared news novell numerical opera panelmasterpagebuttoncontrols problem radio redirect registration relationaldatabases reportemail save schoolproject search security sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio vs2008 web webapplications webdevelopemnt webdevelopment webprogramming webservice wizard xsl youareanotmemberofthedebuggerusers





