How do I send email from ASP using SMTP Authentication in ASP.NET1.1

The following code is developed in VB:

Sub Button1_Click(sender As Object, e As EventArgs)
' Build a MailMessage
Dim mailMessage As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
mailMessage.From = "
from_email@domain.com"
mailMessage.To = "
to_email@domain.com"
mailMessage.Subject = "Email Subject"
mailMessage.Body = "EMail Message Body"
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Html

'Authentication
mailMessage.Fields("
http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
mailMessage.Fields("
http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
mailMessage.Fields("
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
mailMessage.Fields("
http://schemas.microsoft.com/cdo/configuration/sendusername") = "user@domain.com"
mailMessage.Fields("
http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"

System.Web.Mail.SmtpMail.SmtpServer = "mail.domain.com"
System.Web.Mail.SmtpMail.Send(mailMessage)
End Sub

  • 10 Los Usuarios han Encontrado Esto Útil
¿Fue útil la respuesta?

Artículos Relacionados

Do you provide webmail?

Yes, web-based email is provided at no extra charge as part of our service. Webmail is accessible...

Do you provide an outgoing mail server?

Yes, an outgoing mail (SMTP) server is available for our customers hosted domains. Our SMTP...

Do you provide email autoresponders?

Yes, we provide unlimited email autoresponders. Please go to Email Manager of control panel...

Do you provide email aliases?

Yes, we refer to email aliases as email forwarding. We provide unlimited email forwarding...

Do you provide a catch-all email feature?

Yes, we offer a catch-all email feature. You can enable/disable this feature through "Logon...