Last night after a bit of "fun and games" I managed to get my website
http://www.alex-parks.org/ upgraded to .NET Framework 2.0 on GoDaddy. And generally I'm happy.
Unfortunately though sending emails using System.Net.Mail doesn't work, so the site can't send out emails when people register etc. Obviously this has to be addressed.
At the moment I have "smtpout.secureserver.net" with port 80 set on the SMTPClient object (I have to set *something* or there is an error message that says SMTP server is not specified), and the error message I get is
"Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
On .NET 1.1 I didn't have to set the SMTP details, it just "worked". If anyone knows how to get this to work on GoDaddy it'd be much appreciated, I can't believe I'm the only one.
Just thought I would update to say that I've gone back to System.Web.Mail for the time being.
Fortunately this still seems to work, despite the warnings the compiler gives about obsolescence.
Normally I have Option Strict On which had stopped my web app compiling because of the use of System.Web.Mail.
However, after loosening the compiler it's now OK. But I look upon this as a short term solution and I'd still appreciate any answer to get it working with System.Net.Mail.
I would guess that your host and port properties are not set correctly. Just a guess based on the port 80 referenced above (SMTP runs over TCP/25)
Below is an excerpt from MSDN on the SmtpClient call.
To construct and send an e-mail message by using SmtpClient, you must specify the following information:
The SMTP host server that you use to send e-mail. See the
Host and
Portproperties.
Credentials for authentication, if required by the SMTP server. See the
Credentials property.
The e-mail address of the sender. See the
Send and
SendAsync methods that take a from parameter. Also see the
MailMessage.From property.
The e-mail address or addresses of the recipients. See the Send and
SendAsync methods that take a recipient parameter. Also see the
MailMessage.To property.
The message content. See the Send and SendAsync methods that take a
body parameter. Also see the
MailMessage.Body property.
Technical Account Manager
Microsoft Communication Sector North America
This posting is provided "AS IS" with no warranties, and confers no rights. Script samples are subject to the terms at http://www.microsoft.com/info/cpyright.htm"
Posting again to say I have found the solution ! [:)]
After doing more Googling around, it seems that smtpout.secureserver.net was not the correct outgoing server to use, since using this comes back with error messages such as "Mailbox name not allowed" and "not allowed in the list of rctphosts" and such.
The answer is to use an alternative called relay-hosting.secureserver.net. Therefore the code below below should work for you as it now does for me :-
Dim objMailMessage As New System.Net.Mail.MailMessage
With objMailMessage
.IsBodyHtml = False
.From = New MailAddress("fromaddress@youremailaccount.com")
.To.Add("destinationaddress@whoever.com")
.Subject = "Your Subject"
.Body = "Body Text"
End With
Dim objSMTPClient As New System.Net.Mail.SmtpClient("relay-hosting.secureserver.net", 25)
objSMTPClient.Credentials = CredentialCache.DefaultNetworkCredentials
objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.Network
objSMTPClient.Send(objMailMessage)
I'm very glad you found a resolution to the problem. Many thanks for posting back with your solution!
Technical Account Manager
Microsoft Communication Sector North America
This posting is provided "AS IS" with no warranties, and confers no rights. Script samples are subject to the terms at http://www.microsoft.com/info/cpyright.htm"
The solution was nice but I moved to c#. :S I gotta go find a c# version did you find any good sites for this. They cant be that hard to google. Just wondering in your search if you found anything worth while.
I am having the same issue.
Trying to send mail with .NET.MAIL via GODADDY.COm SMTP relay service.
My code still gives me the same error:
<div>Mailbox name not allowed. The server response was: sorry, relaying denied from your location [my IP ADDRESS] (#5.7.1) </div> <div> </div> <div>as I am not sure what to put there or how to setup credentials with goDaddy server, I bet this is my problem.
So if anyone could point me to the right direction how to user Credentials, that would be great.</div> <div> </div> <div>I commented this line though:</div> <div>objSMTPClient.Credentials = CredentialCache.DefaultNetworkCredentials
</div> <div> </div> <div> </div> <div> <div> </div> <div>as I am not sure what to put there or how to setup credentials with goDaddy server, I bet this is my problem.
So if anyone could point me to the right direction how to user Credentials, that would be great.</div></div> <div> </div> <div> <div>Did you have to put EXACT email address that you have setup for relay wih GODADDY, is that how they authenicate you?</div></div>
Yes, I figured out how to use Credentials last night. I specified account that i created for SMTP relay, i even tried passing my domain as a 3rd optional parameter, still get the error that host is not allowed.
I think godaddy support rep hates me by now, for asking so many questions, but they have been very quick to respond as of today.
I host my site locally, so i am wondering if maybe i need to change some setting in IIS, but i belive setting defaultdeliverymethod=network should avoid going trough my local virtual smtp server.
There is one facet of GoDaddy that is somewhat annoying. They make you turn on SMTP email relaying and by default limit you to like 250 outgoing relays per day. You might want to check on your GoDaddy settings to make sure it's enabled.
eddie_mcsd_uk
Member
30 Points
8 Posts
Problem with System.Net.Mail on GoDaddy
Nov 23, 2005 08:45 AM|LINK
Last night after a bit of "fun and games" I managed to get my website http://www.alex-parks.org/ upgraded to .NET Framework 2.0 on GoDaddy. And generally I'm happy.
Unfortunately though sending emails using System.Net.Mail doesn't work, so the site can't send out emails when people register etc. Obviously this has to be addressed.
At the moment I have "smtpout.secureserver.net" with port 80 set on the SMTPClient object (I have to set *something* or there is an error message that says SMTP server is not specified), and the error message I get is
"Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
On .NET 1.1 I didn't have to set the SMTP details, it just "worked". If anyone knows how to get this to work on GoDaddy it'd be much appreciated, I can't believe I'm the only one.
Many thanks
eddie_mcsd_uk
Member
30 Points
8 Posts
Re: Problem with System.Net.Mail on GoDaddy
Nov 23, 2005 06:57 PM|LINK
Fortunately this still seems to work, despite the warnings the compiler gives about obsolescence.
Normally I have Option Strict On which had stopped my web app compiling because of the use of System.Web.Mail.
However, after loosening the compiler it's now OK. But I look upon this as a short term solution and I'd still appreciate any answer to get it working with System.Net.Mail.
jjstreic
Contributor
2545 Points
507 Posts
Re: Problem with System.Net.Mail on GoDaddy
Nov 29, 2005 06:43 PM|LINK
http://msdn2.microsoft.com/en-us/library/system.net.mail.smtpclient.aspx
I would guess that your host and port properties are not set correctly. Just a guess based on the port 80 referenced above (SMTP runs over TCP/25)
Below is an excerpt from MSDN on the SmtpClient call.
To construct and send an e-mail message by using SmtpClient, you must specify the following information:
The SMTP host server that you use to send e-mail. See the Host and Portproperties.
Credentials for authentication, if required by the SMTP server. See the Credentials property.
The e-mail address of the sender. See the Send and SendAsync methods that take a from parameter. Also see the MailMessage.From property.
The e-mail address or addresses of the recipients. See the Send and SendAsync methods that take a recipient parameter. Also see the MailMessage.To property.
The message content. See the Send and SendAsync methods that take a body parameter. Also see the MailMessage.Body property.
Microsoft Communication Sector North America
This posting is provided "AS IS" with no warranties, and confers no rights. Script samples are subject to the terms at http://www.microsoft.com/info/cpyright.htm"
eddie_mcsd_uk
Member
30 Points
8 Posts
Re: Problem with System.Net.Mail on GoDaddy
Dec 05, 2005 04:34 PM|LINK
After doing more Googling around, it seems that smtpout.secureserver.net was not the correct outgoing server to use, since using this comes back with error messages such as "Mailbox name not allowed" and "not allowed in the list of rctphosts" and such.
The answer is to use an alternative called relay-hosting.secureserver.net. Therefore the code below below should work for you as it now does for me :-
jjstreic
Contributor
2545 Points
507 Posts
Re: Problem with System.Net.Mail on GoDaddy
Dec 07, 2005 07:19 PM|LINK
I'm very glad you found a resolution to the problem. Many thanks for posting back with your solution!
Microsoft Communication Sector North America
This posting is provided "AS IS" with no warranties, and confers no rights. Script samples are subject to the terms at http://www.microsoft.com/info/cpyright.htm"
Blake05
Contributor
2558 Points
510 Posts
Re: Problem with System.Net.Mail on GoDaddy
Dec 07, 2005 09:29 PM|LINK
Blog - Website: windowscoding.com
stasevich
Member
15 Points
6 Posts
Re: Problem with System.Net.Mail on GoDaddy
Jan 30, 2006 03:55 AM|LINK
I am having the same issue.
Trying to send mail with .NET.MAIL via GODADDY.COm SMTP relay service.
My code still gives me the same error:
<div>Mailbox name not allowed. The server response was: sorry, relaying denied from your location [my IP ADDRESS] (#5.7.1) </div> <div> </div> <div>as I am not sure what to put there or how to setup credentials with goDaddy server, I bet this is my problem.So if anyone could point me to the right direction how to user Credentials, that would be great.</div> <div> </div> <div>I commented this line though:</div> <div>objSMTPClient.Credentials = CredentialCache.DefaultNetworkCredentials </div> <div> </div> <div> </div> <div> <div> </div> <div>as I am not sure what to put there or how to setup credentials with goDaddy server, I bet this is my problem.
So if anyone could point me to the right direction how to user Credentials, that would be great.</div></div> <div> </div> <div> <div>Did you have to put EXACT email address that you have setup for relay wih GODADDY, is that how they authenicate you?</div></div>
smiling4ever
All-Star
15531 Points
3063 Posts
Re: Problem with System.Net.Mail on GoDaddy
Jan 30, 2006 08:34 AM|LINK
Hello,
Check the following from my hosting KB
Note: You should have POP email/pass with godaddy
Regards
stasevich
Member
15 Points
6 Posts
Re: Problem with System.Net.Mail on GoDaddy
Jan 30, 2006 03:12 PM|LINK
Yes, I figured out how to use Credentials last night. I specified account that i created for SMTP relay, i even tried passing my domain as a 3rd optional parameter, still get the error that host is not allowed.
I think godaddy support rep hates me by now, for asking so many questions, but they have been very quick to respond as of today.
I host my site locally, so i am wondering if maybe i need to change some setting in IIS, but i belive setting defaultdeliverymethod=network should avoid going trough my local virtual smtp server.
tdritzema
Member
5 Points
1 Post
Re: Problem with System.Net.Mail on GoDaddy
Mar 15, 2006 10:04 PM|LINK