Print Page | Close Window

Send e-mail from ASP.Net

Printed From: Web Wiz Forums
Category: Web Wiz Hosting Services Forums
Forum Name: Web Wiz Hosting Support Forums
Forum Description: Support forum for Web Wiz Hosting services and solutions.
URL: https://forums.webwiz.net/forum_posts.asp?TID=30164
Printed Date: 28 March 2026 at 7:14am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Send e-mail from ASP.Net
Posted By: sisc
Subject: Send e-mail from ASP.Net
Date Posted: 17 February 2012 at 10:42am
Hi

Am struggling with this a bit. I have followed what I think are the correct setup instructions and am getting error  "Mailbox unavailable. The server response was: Authentication is required for relay".

My setup and code is as follows:

Am using .Net Framework 4
Web.Config:

<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="mail.WebSiteLive.net" port="25" userName="myemailaddressregistered" password="mypwd" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>

C# Code:

System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("mail.WebSiteLive.net");
client.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(
                                "myemail",
                                "addresstosendto",
                                "TEST",
                                "See....");

client.Send(message);

It's probably something obvious. Thanks for any help!

Mark



Replies:
Posted By: WebWiz-Bruce
Date Posted: 17 February 2012 at 12:09pm
You should contact your web host and ask them what setting you need to relay emails through their mail servers.

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: sisc
Date Posted: 17 February 2012 at 12:39pm
WebWiz are the web host! I thought I'd used the correct setting.


Posted By: WebWiz-Bruce
Date Posted: 17 February 2012 at 4:21pm
I will move this post to the Hosting Support Forums.

The page below has information on sending emails from your website hosted with us:-

http://www.webwiz.net/kb/web-hosting/sending-web-mail.htm" rel="nofollow - http://www.webwiz.net/kb/web-hosting/sending-web-mail.htm

If you are still unable to send email please create a support ticket and include all your settings, including passwords and we can have a look to see what is wrong.

You can create support tickets from the Support Portal at the secure link below:-

https://www.webwiz.net/clientarea/support-portal.htm" rel="nofollow - https://www.webwiz.net/clientarea/support-portal.htm


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: sisc
Date Posted: 18 February 2012 at 6:51am
Got the solution. The problem was caused by the outgoing SMTP server requiring authentication, so an additional hoop needs to be jumped through - a  NetworkCredential is required:

System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("mail.WebSiteLive.net");
System.Net.NetworkCredential crdPassword = new System.Net.NetworkCredential("myemailaccount", "mypassword");
client.Credentials = crdPassword;
client.Send("myemailaccount", "outgoingemailaddress", "Test3", "Hello3");


Hope this helps someone.


Posted By: chriscfox
Date Posted: 17 July 2012 at 11:01pm
After a lot of trial and error, I eventually concluded that this does not work if your email address is "noreply" as in "noreply@yourdomain.com".

Just thought I would post this here in case the next person has a similar problem.

If Bruce is listening, I would be curious to know why that should be.


Posted By: WebWiz-Bruce
Date Posted: 18 July 2012 at 10:11am
noreply@ can be used for sending email to non local email addresses as we use the noreply@ for our Web Wiz Blog and for Network notifications.

If you are using the noreply@ email address as the 'from' email address you will also need to authenticate against our mail servers using the same email address as the username and the password you set for this mailbox in your Control Panel.

One thing that people do miss is that if you update the password for the mailbox in your Control Panel you need to also check the box for 'Change Password' so that the password is also updated on the mail servers. If you do not and the password is not correct the email would not be relayed on to the remote email address.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: haryaziz
Date Posted: 12 August 2012 at 3:30pm
wow, i dont know it. please tell me http://zonakamu.com - http://zonakamu.com
or http://azzu.info - http://azzu.info
you can check it, please help me

http://zonakamu.com


Posted By: chriscfox
Date Posted: 04 October 2012 at 8:33pm
Hello Bruce,

I finally got around to trying the noreply@ option again (sorry it has taken so long!) and it worked. You must be right that I must have forgotten to check the box for 'Change Password' as you suggested.

Thanks as always for your help.
C



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net