By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,967 Members | 843 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,967 IT Pros & Developers. It's quick & easy.

System.Net.Mail Inconsistency...

P: n/a
I am experiencing an inconsistency with System.Net.Mail.

I have a web form on a site. The form gets filled, and one copy gets
sent to the recipient (in**@domain.com). This works just fine.

However, I want a summarized e-mail (with slightly different content) to
get sent to the sender, and this fails unless the “sender”has their
domain name on the same server.

Essentially, it has the following problem:
The SMTP server requires a secure connection or the client was not
authenticated. The server response was: SMTP authentication is required.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Net.Mail.SmtpException: The SMTP server
requires a secure connection or the client was not authenticated. The
server response was: SMTP authentication is required.

Source Error:

Line 40: SmtpClient client = new SmtpClient();
Line 41: client.Send(mail);
Line 42: client.Send(receipt);
Line 43: EmailContent.Text = strContent;
Line 44: EmailSummary.Visible=true;

And yet, the first sending (“mail”, line 41) works, whereas the second
(“recipient” line 42) fails! I Have the web.config fully set up with a
valid SMTP server, and an outgoing username and password, so both
e-mails should be “authenticated” just fine. And yet, thesecond one fails.

web.config:

<system.net>
<mailSettings>
<smtp from="in**@renogoldcorp.com">
<network
host="mail.domain.com"
port="25"
userName="in**@domain.com"
password="########"
defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
Why would this work for one e-mail but not the other? The only thing
that I can see, is that the System.Net.Mail actually tries to send via
the domain of the recipient. But this doesn’t make much sense, since a
generic outgoing gateway was set in web.config which should allow me to
send form-collected, script-assembled e-mail to any valid e-mail address
out there. If System.Net.Mail then goes after the domain of the
recipient, why even bother having such a web.config entry in the first
place????

TIA.
...Geshel
--
************************************************** *******************
My return e-mail address is an automatically monitored spam honeypot.
Do not send e-mail there unless you wish to be reported as a spammer.
Please send all e-mail to my first name at my last name dot org, with
a subject-line of “NEWSGROUP REPLY FOR NEO GESHEL” (all uppercase).
************************************************** *******************
Mar 2 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.