SendingEMail

  • Thread starter Thread starter gh
  • Start date Start date
G

gh

I have an ASP.NET web app that I am trying to sens an email from. I use
the code below to send it.

mailMsg := MailMessage.Create;
mailMsg.From := self.Session['SMTPADDRESS'].ToString;
mailMsg.&To := aEMail;
mailMsg.BCC := aAdminEMail;
mailMsg.Subject := 'Your LoginID and Password';
mailMsg.BodyFormat := MailFormat.Text;
mailMsg.Body := 'Your LoginID is '''+aLogin+''' and Password
'''+aPassword+'''';
SmtpMail.SmtpServer := aSMTPServer;

SmtpMail.Send(mailMsg);

My mail server requires password authentication. Where do I assign the
password?

TIA
 
The following solution is officially unsupported - but it works (you
otherwise need to use CDO or something else to authenticate).

Add these lines to your code before you call SmtpMail.Send()

mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1"); //basic authentication
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
myLoginID); //set your username here
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
myPassword); //set your password here


-HTH
 
Back
Top