Monday, March 26, 2012

System.net.Mail default smtp host

i was using the old system.web.mail classes.
and try to sent emails with net.mail, but i get an exception:
System.Net.Mail.SmtpFailedRecipientException was unhandled by user code
Message="Mailbox unavailable. The server response was: 5.7.1 Unable to relay for bla@dotnet.itags.org.bla.bla"

host property of SmtpClient must be set up! but what is default smpt host? is it "localhost"? i get an exception if i use it.Tongue Tied
thank u for ur advice

if i use this code it works for me (System.Web.Mail):

SmtpMail.SmtpServer =null;

SmtpMail.Send(mail);
because the name of the local SMTP server is used!!!!!!
WHAT NAME IS IT? how can i find it out?
i need the name to set the Host property of SmtpClient (System.Net.Mail).
thank u for ur advice


Hello.

I believe that you should use the classes SmtpClient and MailMessage to send your email message.


i still need ur help
Hello.
See if this helps:
http://www.developer.com/net/net/article.php/3511731

hi,

i m sorry but it has nothing to do with my question!


Hello.
not sure on what you0re after, but normally you use set that propertywith the name of the server. and you're the only one that know that...

Hi,
Did you find a solution to this problem...I am having the same problem. I use System.Mail.Net with the following code
SmtpClient client = new SmtpClient("localhost");
client.Send(message);
And get the following error
Mailbox unavailable. The server response was: 5.7.1 Unable to relay for abc@.
abc.abc
Many thanks for any help you can provide.

msplants wrote:

Hi,
Did you find a solution to this problem...I am having the same problem. I use System.Mail.Net with the following code
SmtpClient client = new SmtpClient("localhost");
client.Send(message);
And get the following error
Mailbox unavailable. The server response was: 5.7.1 Unable to relay for abc@.
abc.abc
Many thanks for any help you can provide.


As the error says:
The email server is not accepting mail from the server that the code resides in...
despite the fact that this site is based on 1.1's mail code, the server errors apply to any code trying to use a mail server
http://www.systemwebmail.net/faq/4.3.11.aspx

hey,

no, i still can not find the answer!

localhost is not a default smtp server.
HOW TO FIND THE NAME OFdefault smtp server?


stWooE wrote:

HOW TO FIND THE NAME OFdefault smtp server?


- Ask your IT department
or
- Goto the computer where the SMTP service lives, and use either (1) The name of the computer or (2) the IP address of the computer
And as noted in my last post, if there is any sort of permissions/security set on the SMTP service, you'll need to allow your web server to "relay" mail through it, all of it is at that website i linked to
- i talk all the time about my local smpt server
- for sure, i have tried the name of my comuter and ip, i get the same error!
i can only send emails with the deprecated classes from the version 1.1
but thank u anyway

this problem disppears if I change the Relay properties to "All except the list below", however this is not an acceptable configuration. Any help from here?
Thanks in advance


Hi, i know this post is rather old but i've searched the forums and found this thread hanging around and i have exactly the same problem as the original poster and i was wondering if perhaps some1 could give me some insight as to how to solve this this time around.

What do i type in host?

tx in advance,

Me


It's an even older post now, and I spent ages finding an answer to this problem, which still doesn't clearly appear her. So here goes:

If you are using the SMTP server that is installed with IIS, you need to allow relaying for 127.0.0.1 (localhost) in the SMTP Server properties. This can be found on the Access tab at the bottom - Relay Restrictions.

Under "Select which computer may relay through this virtual server", "Only the list below" should be checked. If not, check it, as this will prevent spammers hijacking your SMTP server. Then click "Add" and add 127.0.0.1 into the IP address.

In your script, you may well have something like this:

SmtpClient client = new SmtpClient();
client.Send(message);

You now need to add the bold line below:

SmtpClient client = new SmtpClient();
client.Host = "127.0.0.1";
client.Send(message);

Hope This Helps.

0 comments:

Post a Comment