Click here to Skip to main content
15,917,642 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am trying to sending email on server but getting error of "failure send mail".
cant understand what is the problem please help me out.
here is code

try
           {
               MailMessage mail = new MailMessage(Txtfromaddress.Text,"contact@logicalkeys.com");
               mail.Subject = Txtname.Text;
               mail.Body = Txtmesage.Text;
               SmtpClient client = new SmtpClient();
               client.Send(mail);
           }
           catch (Exception ex)
           {
               errormessage.InnerText = ex.Message;
           }

web.config

XML
<mailSettings >
      <smtp deliveryMethod="Network">


        <network host="smtp.mail.logicalkey.com" userName="contact@logicalkeys.com" password="acbgtsd" enableSsl="true" />
      </smtp>
    </mailSettings>
Posted
Updated 8-Dec-13 20:08pm
v2
Comments
JoCodes 9-Dec-13 2:11am    
Whats the complete error message ???
fak_farrukh 9-Dec-13 2:14am    
This is complete error
"failure sending mail"
JoCodes 9-Dec-13 2:23am    
Add an open port number inside the webconfig settings and check.
JoCodes 9-Dec-13 2:23am    
If that also is not working then the firewall might be blocking it.
fak_farrukh 9-Dec-13 3:29am    
i have give port num and check firewall now error is "Mailbox unavailable. The server response was: This is a submission only port. You must authenticate before sending mail"

Is your mail server using SSL Certificate? If no then try removing the enableSSL=true from the web.config file
 
Share this answer
 
Comments
fak_farrukh 9-Dec-13 1:59am    
i have remove this enableSSL=true but error still remains
Try using a port number which is open inside the webconfig seetings like

<network host="smtp.mail.logicalkey.com" port="25" username="contact@logicalkeys.com" password="acbgtsd" enablessl="true" />


Port number should be changed as per your settings

http://www.planetmagpie.com/networksupport/whatyouneed/emailsettings/changesmtpport.aspx[^]

If still the problem persists check your firewall settings
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900