pinoyz

how to get the address of smtp server and port ex. google, yahoo or other mail

regards




Re: Visual Basic Express Edition how to get the address of smtp server and port? ex. google, yahoo or other mail

ReneeC

Google is a POP provider which serves mail client such as Outlook Express and Vista Mail.

In its mail setup pages, google provides the information you are asking for. Google also uses SSl which is a secure server. Because of this a port parameter is also important.






Re: Visual Basic Express Edition how to get the address of smtp server and port? ex. google, yahoo or other mail

pinoyz

Hi ReneeC

I can't Find the details what i'm asking.....IP.Address.Of.Smtp and port... i look into settings but i can't find sorry for stupid question....

i'm trying to make a program that's sends email that's why i'm asking..

regards






Re: Visual Basic Express Edition how to get the address of smtp server and port? ex. google, yahoo or other mail

pinoyz

Here's an example of email that send that i found



Dim theMailMessage as new MailMessage()
theMailMessage.To = yourEmail@address.com
theMailMessage.From = yourEmail@Address.com
theMailMessage.Subject = "Bug report"
theMailMessage.Body = "texthere"
theMailMessage.Attachments = new MailAttachment("filename")

SmtpMail.SmtpServer = "IP.Address.Of.SMTP.Server" <---- where to get this
SmtpMail.Send(theMailMessage)






Re: Visual Basic Express Edition how to get the address of smtp server and port? ex. google, yahoo or other mail

Paul Montagna

I think its smtp.gmail.com and if you need a port i think its 465





Re: Visual Basic Express Edition how to get the address of smtp server and port? ex. google, yahoo or other mail

killer7k

Hi Pinoyz ,

If You Have Gmail account

SmtpMail.smtpServer=("smtp.gmail.com")
SmtpMail.port=587

or declare it Like This

Dim mailClient As New System.Net.Mail.SmtpClient("smtp.gmail.com", 587)






Re: Visual Basic Express Edition how to get the address of smtp server and port? ex. google, yahoo or other mail

ReneeC

Imports System.Net.Mail

Imports System.Reflection

Imports System.Net.NetworkCredential

Imports System.Text

Public Class Form1

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim Body As String = "Message goes here"

SendMessage("Anyone@bellsouth.net", "SomeAccount@gmail.com", Body, "Subject goes here")

End Sub

Public Sub SendMessage(ByVal [To] As String, ByVal Fromm As String, ByVal Body As String, ByVal Subject As String)

Dim too As New MailAddress([To])

Dim from As New MailAddress(Fromm)

Dim message As MailMessage = New MailMessage(from, too) ' subject, body)

message.Subject = Subject

message.Body = Body

Dim client As SmtpClient = New SmtpClient("smtp.gmail.com", 587)

client.Timeout = 30000

client.EnableSsl = True

client.Credentials = New System.Net.NetworkCredential("SomeAccount", "SomePassword", "") ' Username does not have @gmail.com

Try

client.Send(message)

Catch e As Exception

Me.Text = e.Message + " " & e.InnerException.Message

End Try

Me.Opacity = 100

End Sub

Be careful, this board has linewrapping which will make it appear there are syntax errors when there are not.