HELP: SMTP SmtpMail How do I set a username and password?

T

T.Archer

The host a client wants to use requires authentication to relay messages.

How do I set the authentication (username/password) before using the
smtpmail.send(mailmessage) method?

Surely this must be a common thing to do. I have been utterly unable to
google an answer.

--Tony Archer
 
M

Mark Fitzpatrick

The mail functionality that the System.Web.Mail class represents doesn't
have authenticated SMTP mail capabilities. You'll need to find another
compoennt in order to send an SMTP server that requires authentication.
Tgere are lots of free ones out there though so that's not a big problem.
There's an open-source SMTP project at:
http://sourceforge.net/projects/opensmtp-net/ that may work nicely.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
M

MWells

Actually, I believe that there is a way, but you have to specify the headers
manually.

For an example, see;
http://www.paulsadowski.com/WSH/cdo.htm

'==This section provides the configuration information for the remote SMTP
server.

'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") =
cdoBasic

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") =
"youruserid"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") =
"yourpassword"


However, Mark's recommendation is best; there are a number of solid
..NET-specific email components out there with fantastic capabilities.
You'll probably be better off avoiding CDO.

/// M
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top