need to send mail from yahoo to gmail of mailing concept

Posted by Nithu under VB.NET on 7/19/2012 | Points: 10 | Views : 3614 | Status : [Member] | Replies : 6
Hi

i try to send mail from yahoo to gmail in vb.net application using this code but not working


Dim DisplayName As String = "asaaaa"
Dim Subject As String = "asas-yah"
Dim Body As String = "Asa"
Dim Tom As String = "receiver@yahoo.co.in"

Dim ClientPort As Int16
Dim SenderEmailId, SenderPassword, SenderSmtpAddress As String
Try

ClientPort = 465
SenderSmtpAddress = "smtp.mail.yahoo.com"
SenderEmailId = "sender@yahoo.in"
SenderPassword = "password"


Dim msg As MailMessage = New MailMessage()
msg.To.Add(Tom)
msg.From = New MailAddress(SenderEmailId, DisplayName, System.Text.Encoding.UTF8)
msg.Subject = Subject
msg.SubjectEncoding = System.Text.Encoding.UTF8
msg.Body = Body
msg.BodyEncoding = System.Text.Encoding.UTF8
msg.IsBodyHtml = True
msg.Priority = MailPriority.High


Dim client As SmtpClient = New SmtpClient()
client.Credentials = New System.Net.NetworkCredential(SenderEmailId, SenderPassword)
client.Port = ClientPort
client.Host = SenderSmtpAddress
client.EnableSsl = False
client.Send(msg)




Responses

Posted by: Rickeybglr on: 7/20/2012 [Member] Starter | Points: 25

Up
0
Down
can u please tell us what is the error message... so we can work out on ths

Nithu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 7/20/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Try this

client.EnableSsl = True


Nithu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nithu on: 7/20/2012 [Member] Starter | Points: 25

Up
0
Down
the error is " Unable to connect to the remote server "

Nithu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rickeybglr on: 7/20/2012 [Member] Starter | Points: 25

Up
0
Down
u can try below things:
client.EnableSsl = True
check tht SMTP is Up or not
vberify the parameters of Send method. i think it takes 4 parametrs..

Nithu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nithu on: 7/20/2012 [Member] Starter | Points: 25

Up
0
Down

Shall i know how to find the smtp yahoo port id in my system .
otherwise any other way to write the coding for all domain to other
like yahoo to gmail or hotmail to yahoo like this


Nithu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rickeybglr on: 7/22/2012 [Member] Starter | Points: 25

Up
0
Down
these port no. are fixed u can find easily on internet ..

Incoming mail server settings
POP server: pop.mail.yahoo.com
Use SSL
Port: 995

Outgoing mail server (SMTP) settings
SMTP server: smtp.mail.yahoo.com
Use SSL
Port: 465
Use authentication
Account Name/Login Name: Your Yahoo! Mail ID (your email address without the "@domain.com"
Email Address: Your Yahoo! Mail address (for example, abc@yahoo.com)
Password: Your Yahoo! Mail password


Nithu, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response