SMTP IN VB.NET HELP

Discussion in 'Microsoft VB .NET' started by dansuthar@gmail.com, May 10, 2007.

  1. Guest

    Hi everyone there,
    I want some help in sending mails using .net 2.0 form vb.net.
    i use the following code to send SMTP Mails:

    Code:Dim client As New Net.Mail.SmtpClient("smtp.gmail.com")
    Dim mm As New Net.Mail.MailMessage("",
    "")
    mm.Body = "<h1>Hello World</h1>"
    Dim client As New Net.Mail.SmtpClient("mail.MyDomain.com")
    client.Credentials = New Net.NetworkCredential("MyUserName",
    "MyPassword")
    client.Send(mm)


    Now , I have made an app (LIKE SMTP MAIL CLIENT) that takes user's
    username and password to send e-mails.. But, The problem is that if
    the user (by mistake!) enters worng id or password then My app returns
    an error only when the user tries to send the email ! But what i want
    is to make is a login at "statup" so user enters id and password at
    startup and my app tries to LOGIN to the server and if id or password
    is wrong then my app will shows the error of wrong information at just
    on the startup (Not while send e-mails - - like most of messangers
    have !)

    I tries very much but can't find anyting (Something Like client.login
    like I used client.Send(mm) !! )

    Any Idea ??

    Regards,
    Dan
     
    , May 10, 2007
    #1
    1. Advertisements

  2. sloan Guest

    See

    http://sholliday.spaces.live.com/blog/
    2/8/2006
    Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0)




    to read about the authentication methods, and download code samples.




    <> wrote in message
    news:...
    > Hi everyone there,
    > I want some help in sending mails using .net 2.0 form vb.net.
    > i use the following code to send SMTP Mails:
    >
    > Code:Dim client As New Net.Mail.SmtpClient("smtp.gmail.com")
    > Dim mm As New Net.Mail.MailMessage("",
    > "")
    > mm.Body = "<h1>Hello World</h1>"
    > Dim client As New Net.Mail.SmtpClient("mail.MyDomain.com")
    > client.Credentials = New Net.NetworkCredential("MyUserName",
    > "MyPassword")
    > client.Send(mm)
    >
    >
    > Now , I have made an app (LIKE SMTP MAIL CLIENT) that takes user's
    > username and password to send e-mails.. But, The problem is that if
    > the user (by mistake!) enters worng id or password then My app returns
    > an error only when the user tries to send the email ! But what i want
    > is to make is a login at "statup" so user enters id and password at
    > startup and my app tries to LOGIN to the server and if id or password
    > is wrong then my app will shows the error of wrong information at just
    > on the startup (Not while send e-mails - - like most of messangers
    > have !)
    >
    > I tries very much but can't find anyting (Something Like client.login
    > like I used client.Send(mm) !! )
    >
    > Any Idea ??
    >
    > Regards,
    > Dan
    >
     
    sloan, May 10, 2007
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dino M. Buljubasic

    How to test if an SMTP server exists from a VB.net application

    Dino M. Buljubasic, Sep 21, 2003, in forum: Microsoft VB .NET
    Replies:
    5
    Views:
    1,298
    steve
    Sep 23, 2003
  2. Chad Z. Hower aka Kudzu

    Free FTP, NNTP, SMTP, POP3 and more for .Net

    Chad Z. Hower aka Kudzu, Jan 22, 2004, in forum: Microsoft VB .NET
    Replies:
    0
    Views:
    308
    Chad Z. Hower aka Kudzu
    Jan 22, 2004
  3. Toble Rone

    SMTP e-mail from VB.NET

    Toble Rone, Mar 4, 2004, in forum: Microsoft VB .NET
    Replies:
    8
    Views:
    192
    Chad Z. Hower aka Kudzu
    May 22, 2004
  4. Sunil Jagadish

    POP & SMTP using VB.NET

    Sunil Jagadish, Mar 22, 2004, in forum: Microsoft VB .NET
    Replies:
    4
    Views:
    810
    Herfried K. Wagner [MVP]
    Mar 22, 2004
  5. Joe

    Sending Mail(smtp) in vb.net-HELP!!

    Joe, Mar 4, 2005, in forum: Microsoft VB .NET
    Replies:
    2
    Views:
    207
    Peter Proost
    Mar 4, 2005
Loading...

Share This Page