Already tried it...Gives an error..."Couldnot find the smtp server".So instead of using "smtp.gmail.com" I used the IP address available on the net.It then gives the error.."Unable to connect to the remote server."
thanks all but i think there were some problems with the server...bacause now the above given code is working perfectly well.Thanks all for your contribution.
Guevara_che2
Member
33 Points
20 Posts
Need a working gmail smtp mail server ip address and port number.
Apr 09, 2011 10:42 AM|LINK
Want to send email through my application....I need gmail smtp mail server ip address and port number.Can any one help?
prabinyovan
Contributor
2401 Points
531 Posts
Re: Need a working gmail smtp mail server ip address and port number.
Apr 09, 2011 11:25 AM|LINK
Try this,
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage(); msg.To.Add("toaddress@domain.com"); msg.From = new MailAddress("youraddress@domain.com", "Your Name"); msg.Subject = "Subject"; msg.SubjectEncoding = System.Text.Encoding.UTF8; msg.Body = "Message"; msg.BodyEncoding = System.Text.Encoding.UTF8; msg.IsBodyHtml = true; // if msg is in html format msg.Priority = MailPriority.High; //Add the Creddentials SmtpClient client = new SmtpClient(); client.Credentials = new System.Net.NetworkCredential("youaddress@domain.com", "password"); client.Port = 587; client.Host = "smtp.gmail.com"; client.EnableSsl = true; object userState = msg; try { client.Send(msg); } catch (System.Net.Mail.SmtpException ex) { MessageBox.Show(ex.Message, "Send Mail Error"); }Nothing is really over,until the moment u stop trying for it....
Guevara_che2
Member
33 Points
20 Posts
Re: Need a working gmail smtp mail server ip address and port number.
Apr 11, 2011 05:08 AM|LINK
Already tried it...Gives an error..."Couldnot find the smtp server".So instead of using "smtp.gmail.com" I used the IP address available on the net.It then gives the error.."Unable to connect to the remote server."
prabinyovan
Contributor
2401 Points
531 Posts
Re: Need a working gmail smtp mail server ip address and port number.
Apr 16, 2011 11:58 AM|LINK
Did u enable the POP3 in your gmail account?
Nothing is really over,until the moment u stop trying for it....
Guevara_che2
Member
33 Points
20 Posts
Re: Need a working gmail smtp mail server ip address and port number.
Apr 23, 2011 07:55 AM|LINK
biradar.shiv
Member
2 Points
1 Post
Re: Need a working gmail smtp mail server ip address and port number.
Nov 16, 2011 02:58 AM|LINK
what all are the jar files required for this
chathuranga
Member
45 Points
34 Posts
Re: Need a working gmail smtp mail server ip address and port number.
Nov 16, 2011 03:07 AM|LINK
use this in ur code
SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", Convert.ToInt32(25));
Guevara_che2
Member
33 Points
20 Posts
Re: Need a working gmail smtp mail server ip address and port number.
Nov 16, 2011 04:42 AM|LINK
thanks all but i think there were some problems with the server...bacause now the above given code is working perfectly well.Thanks all for your contribution.