Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Send e-mail from ASP.Net
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Send e-mail from ASP.Net

 Post Reply Post Reply Page  12>
Author
sisc View Drop Down
Newbie
Newbie


Joined: 30 March 2011
Location: United Kingdom
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote sisc Quote  Post ReplyReply Direct Link To This Post Topic: Send e-mail from ASP.Net
    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
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
sisc View Drop Down
Newbie
Newbie


Joined: 30 March 2011
Location: United Kingdom
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote sisc Quote  Post ReplyReply Direct Link To This Post Posted: 17 February 2012 at 12:39pm
WebWiz are the web host! I thought I'd used the correct setting.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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:-


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:-

Back to Top
sisc View Drop Down
Newbie
Newbie


Joined: 30 March 2011
Location: United Kingdom
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote sisc Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
chriscfox View Drop Down
Newbie
Newbie
Avatar

Joined: 04 August 2010
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote chriscfox Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (1) Thanks(1)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
haryaziz View Drop Down
Newbie
Newbie
Avatar

Joined: 12 August 2012
Location: indonesia
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote haryaziz Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.