Knowledgebase

How to send email from page code?

To use mail.yourdomain.com, you have to create an account First. To do this - log in to your Control Panel, enter your Hosting space and then in Mail Accounts. Click on Create a Mail account and choose domain . When you enter your mail domain - which is your registered domain - you will be able to create a Mail account. This account is used as a username in the code.

password= the password of the mail account.

 

Then try this code again:

Web.config

<system.net>

<mailSettings>

<smtp>

<network host="mail.yourdomain.com" port="8889" userName="yourmail@yourdomain.com" password="password" />

</smtp>

</mailSettings>

</system.net>

 

Code

dim FromAddress As String ="name@yourdomain.com"

dim ToAddress As String ="name@anydomain.com"

'Create the MailMessage instance

Dim MyMailMessage As New MailMessage(FromAddress, ToAddress)

' Assign the MailMessage's properties

MyMailMessage.Subject = Subject.Text

MyMailMessage.Body = Body.Text

MyMailMessage.IsBodyHtml = False

' Create the SmtpClient object

Dim smtp As New SmtpClient

' Send the MailMessage (will use the Web.config settings)

smtp.Send(MyMailMessage)

Was this answer helpful?

 Print this Article

Also Read

Which framework is using my site by default?

The Application pool is 2.0 by default, it covers Framework 2.0, 3.0 and 3.5. You can change it...

How to override default spam settings for this domain?

Login to your webmail - http://mail.yourdomain with your administrator email account Go to...

Which are your mail server settings?

Below is the information of your POP3/SMTP/IMAP server. You can always access your mailbox(es)...

How to restore my current MSSQL database to hosting DB?

Create backup of your local DB with MS SQL server 2008 Managemet studio, then upload it to your...

Do you support ASP.NET MVC 3?

Yes, we support ASP.NET MVC 2 and ASP.NET MVC 3