Solved

send mail in vb 2008 with autentication

Posted on 2009-04-02
4
879 Views
Last Modified: 2013-11-30
I'm using this code:
'''
'''
See code


'''
'''

Im' reciving:
+System.Net.Mail.SmtpException      5.7.3 Requested action aborted; user not authenticated"}      System.Net.Mail.SmtpException

Try

            Dim Message As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()

            Dim Smtp As New System.Net.Mail.SmtpClient()

            Dim SmtpUser As New System.Net.NetworkCredential()

            '-- Build Message

            Message.From = New System.Net.Mail.MailAddress("xxx@hotmail.com", "My name")

            Message.To.Add(New System.Net.Mail.MailAddress("email@server.com", "Other Name"))

            Message.IsBodyHtml = False

            Message.Subject = "Come on My Show Soon"

            Message.Body = "Please be a guest on my show. - Larry"

            '-- Define Authenticated User

            SmtpUser.UserName = "xxl@hotmail.com" 

            SmtpUser.Password = "Password"

            SmtpUser.Domain = "smtp.live.com"

            '-- Send Message

            Smtp.UseDefaultCredentials = False

            Smtp.Credentials = SmtpUser

            Smtp.Host = "smtp.live.com"

            Smtp.EnableSsl = True

            Smtp.Port = 25

            Smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network

            Smtp.Send(Message)

            MessageBox.Show("OK")

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

Open in new window

0
Comment
Question by:cpx_Support
4 Comments
 
LVL 3

Accepted Solution

by:
Dgleich earned 500 total points
Comment Utility
Hmm Try this code:

Just change it to use diffrent smtp server...
        Dim message As System.Net.Mail.MailMessage

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

        smtp.Credentials = New System.Net.NetworkCredential("Your gmail username", "password")

        message = New System.Net.Mail.MailMessage("From:", "To:", "Subject", "mail here")

        smtp.EnableSsl = True

        smtp.Send(message)

Open in new window

0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
0
 
LVL 74

Expert Comment

by:käµfm³d 👽
Comment Utility
Last I heard, Hotmail (and I assume Live as well) didn't have a public interface to send email through code. Because it's web-based, you have to go through browser. I'd love to know otherwise.
0
 

Author Comment

by:cpx_Support
Comment Utility
Hello emoreau i looked the link but I think i'm using the correct configuration but doen't work.

Kaufmed, I read that Hotmail now let users send mail throug smtp but in any case I tried with gmail and I'm getting the same error.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now