Click here to Skip to main content
15,908,115 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
C#
try
        {
            MailAddress from = new MailAddress("from@yahoo.com", "name", Encoding.UTF8);
            MailAddress to = new MailAddress("to@yahoo.com");
            MailMessage message = new MailMessage(from, to);
            message.Subject = "Test";
            message.SubjectEncoding = Encoding.UTF8;
            message.Body = "Test";
            message.BodyEncoding = Encoding.UTF8;
            SmtpClient client = new SmtpClient();
            client.Host = "ssl://181.40.105.33";
            client.Port = 465;
            client.EnableSsl = true;
            client.Credentials = new NetworkCredential("example@yahoo.com", "Password");
            client.Send(message);
            MessageBox.Show("sending Successfully!!!");
        }
        catch (SmtpException ex)
        {
            MessageBox.Show(ex.ToString());
        }

exception through time out.
Posted
Updated 21-Oct-12 23:43pm
v3
Comments
Herman<T>.Instance 22-Oct-12 6:18am    
why you state ssl:// in stead of http:// or https:// ?
Sergey Alexandrovich Kryukov 22-Oct-12 17:10pm    
I think you are quite right. I added a couple referenced to related topics in my answer, please see.
--SA

I think digimanus is right: a host cannot be "ssl". I don't think such URI Scheme exists as a well-known (IANA-registered) scheme; please see:
http://en.wikipedia.org/wiki/URI_scheme#Official_IANA-registered_schemes[^].

—SA
 
Share this answer
 
The Host property cannot have a protocol specified like you did with "ssl://". It requires either a host name, resolvable by DNS, or an IP address. Don't put anything in there. It's going to look like either "smtp.myserver.com" or "123.23.54.67".
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 23-Oct-12 9:17am    
Right, a 5.
--SA

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