Wrox Programmer Forums
|
BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 by Thearon Willis, Bryan Newsome; ISBN: 9780764574016
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 11th, 2006, 09:57 AM
Registered User
 
Join Date: Oct 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch 11 SMTP SendMail Authentication Required

My mail service requires authentication (i.e. name & password) before it will accept and send an email. The code for sending an email on pages 236-7 is missing a two statements.

First, you need to add a second Imports statement for namespace System.Net in addition to the one for System.Net.Mail. Put put both these Import statements above the POMessage class definition.

Second, you need to populate the credentials before calling Send:

        Dim MyMailServer As New SmtpClient()
        With MyMailServer
        .Host = "your.smtp.host.goes.here"
            .Credentials = New NetworkCredential("UserName", "pswd")
            .Send(POMessage)
        End With
        MessageBox.Show("Message sent")

After adding these two statements, the sendmail procedure worked for me. There is a third variable, domain, that can be set in NetworkCredential. My ISP (verizon.net) required that item to be left empty (null). Your provider may have different requirements.


hit 'em straight,
MR





Similar Threads
Thread Thread Starter Forum Replies Last Post
sending email with SMTP authentication (port 26) crmpicco PHP How-To 3 November 4th, 2007 01:18 PM
SMTP Authentication and mail() lemonadeX Pro PHP 1 July 31st, 2007 10:06 AM
Help required for Directory Authentication MSUser General .NET 2 March 29th, 2004 03:56 AM
SMTP Mail with User Authentication ~Bean~ VB How-To 0 November 6th, 2003 10:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.