Results 1 to 9 of 9

Thread: [RESOLVED] [2205] specify the mail server address

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Resolved [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.

  2. #2
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    262

    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    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.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    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")

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    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:
    1. Dim smtp As New SmtpClient(Me.smtpTextBox.Text)
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    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.

  8. #8
    New Member
    Join Date
    Jan 2007
    Posts
    2

    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!

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    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
  •  



Click Here to Expand Forum to Full Width