|
-
Jan 5th, 2007, 05:40 AM
#1
Thread Starter
Addicted Member
[RESOLVED] [2205] specify the mail server address
Hi,
I copied this code from web site:
http://www.systemnetmail.com/faq/2.1.aspx
Code:
Sub PlainText()
'create the mail message
Dim mail As New MailMessage()
'set the addresses
mail.From = New MailAddress("[email protected]")
mail.To.Add("[email protected]")
'set the content
mail.Subject = "This is an email"
mail.Body = "this is the body content of the email."
'send the message
Dim smtp As New SmtpClient("127.0.0.1")
smtp.Send(mail)
End Sub 'PlainText
My question is:
How can I get these numbers:
Code:
Dim smtp As New SmtpClient("127.0.0.1")
Thanks in advance
Last edited by yulyos; Jan 5th, 2007 at 06:50 AM.
-
Jan 5th, 2007, 06:16 AM
#2
Hyperactive Member
Re: specify the mail server address
From you isp or from whoever manages your internal e-mail server.
eg my isp is post.demon.co.uk if you ping this you get the ip 194.217.242.89
but you better of using the name rather than the ip.
-
Jan 5th, 2007, 06:48 AM
#3
Thread Starter
Addicted Member
Re: specify the mail server address
Hi,
I'm using:
Code:
Dim ip As IPAddress = Dns.GetHostAddresses(Dns.GetHostName())(0)
MessageBox.Show(ip.ToString)
But the numbers that I get, they are not good.
-
Jan 5th, 2007, 07:56 AM
#4
Re: [2205] specify the mail server address
How do you send e-mail using a mail client? You ask your ISP for the address of their SMTP server and you type it in. The same is true of sending mail using VB. You get the address of your ISP's SMTP server and you type it in. If you already have the server name then you don't need to get the IP address because the SmtpClient constructor will accept either. Get the address of your SMTP server and just type it straight in, either at design time if you want it hard-coded or run time if you want to be able to change it.
-
Jan 5th, 2007, 08:00 AM
#5
Thread Starter
Addicted Member
Re: [2205] specify the mail server address
This is working:
Dim smtp As New SmtpClient("smtp.internet service provider")
'
But I want to give the program to my friend and he will send me an Email From my program.
The program need to know the ("smtp.internet service provider") of my friend.
Do you know the code to find the ("smtp.internet service provider")
-
Jan 5th, 2007, 09:58 AM
#6
Re: [2205] specify the mail server address
There is no code to find. Like I said, you can specify the value of the SMTP server name at run time if you want it to be variable. I'm quite sure that you've provided a means for the user to enter a string value before. You need to do it again, e.g.
VB Code:
Dim smtp As New SmtpClient(Me.smtpTextBox.Text)
-
Jan 5th, 2007, 10:10 AM
#7
Thread Starter
Addicted Member
Re: [2205] specify the mail server address
Hi,
Thanks jmcilhinney
and to Everybody that try to help.
I don’t have a choice I'll use smtp.gmail.com
Last edited by yulyos; Jan 5th, 2007 at 10:15 AM.
-
Jan 5th, 2007, 05:38 PM
#8
New Member
Re: [2205] specify the mail server address
Just ask your ISP or tell your friend to ask his ISP for the their SMTP server (e.g. Adelphia = mail.adelphia.net). Every ISP must give its users an SMTP, Gateway, DNS etc... or find one for free like dyndns.org = mail.dyndns.org. Just need to make sure that these free smtp servers can relay to your SMTP. Good luck!
-
Jan 6th, 2007, 04:11 AM
#9
Thread Starter
Addicted Member
Re: [2205] specify the mail server address
Hi,
I want to build a clever program to a stupid user.
I'll use smtp.gmail.com
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|