ASP Form mail script with smtp authentication

 

<%@ Import Namespace="System.Web.Mail" %>

 

 

<script language="VB" runat="server">

Sub Page_Load(Sender As Object, E As EventArgs)

 

Dim msg as New MailMessage()

 

msg.To = "mailto@sender.com"

msg.From = "sender@domain.com"

msg.Subject = "test"

'msg.BodyFormat = MailFormat.Html

msg.BodyFormat = MailFormat.Text

msg.Body = "hi"

 

 

msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "domain.com")

msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25)

msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", 2) '2 to send using SMTP over the network

 

 

msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'basic authentication

msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "email@domain.com") 'set your username here

msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "123456") 'set your password here

 

 

' SmtpMail.SmtpServer = "domain.com"

 

SmtpMail.Send(msg)

msg = Nothing

lblMsg.Text = "An Email has been Sent"

 

End Sub

</script>

 

 

<form runat=server>

<asp:Label id=lblMsg runat=Server /> </form>

 

 

  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

PHP Form mail script with smtp authentication

PHP mail() and SMTP AuthenticationPart of what makes the PHP mail() function is so simple is its...

Setting file/folder permissions from Plesk control panel for Windows

For users on Plesk for Windows: Login to Plesk control panel using the URL ...

Setting file/folder permissions from Plesk control panel for Windows

For users on Plesk for Windows: Login to Plesk control panel using the URL ...

Setting file/folder permissions from Plesk control panel for Windows

For users on Plesk for Windows: Login to Plesk control panel using the URL ...

ASP.net Sample Form mail script with smtp authentication for Windows

    <%@ Import Namespace="System.Web.Mail" %>   <script language="VB"...

Powered by WHMCompleteSolution