Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to configure IP address to the SmtpClient.

var smtp = new System.Net.Mail.SmtpClient();
        {
            smtp.Host = "127.0.0.0";
            smtp.Port = 25;
            smtp.EnableSsl = true;
            smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
            smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
            smtp.Timeout = 20000;
        }
        try
        {
            smtp.Send(fromAddress, toAddress, subject, body);
        }
        catch(Exception ex) {
            Response.Write(ex);
        }


How to configure server IP address
Posted
Updated 28-Feb-14 0:20am
v2
Comments
ZurdoDev 28-Feb-14 7:37am    
You have it. It's smtp.Host. What exactly is your question?
Gokul Athithan 1-Mar-14 0:03am    
I am Using SmarterMail how to configure the IP address in the smtp.Host.
george4986 1-Mar-14 4:13am    
whats ur requirement?
ZurdoDev 1-Mar-14 7:43am    
You have to know the IP address. I still don't understand where you are confused.
Gokul Athithan 1-Mar-14 8:36am    
sorry i have given wrong IP, now its Clear.

Try port 465 or 587 instead

465 starts unencrypted and then switches to SSL.
587 starts with SSL

What you need depends on the mail server.
 
Share this answer
 
v2
As mentioned in the comments, you need to find out what the proper IP address is and then fill it in in your code. This will be found by your SMTP admin, if you have one.
 
Share this answer
 
I have given Wrong IP address.
 
Share this answer
 
Comments
ZurdoDev 1-Mar-14 7:44am    
Do you mean you figured out what the correct IP is?

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