System.Net.Mail Inconsistency...

N

Neo Geshel

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 ([email protected]). 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, the second one fails.

web.config:

<system.net>
<mailSettings>
<smtp from="(e-mail address removed)">
<network
host="mail.domain.com"
port="25"
userName="(e-mail address removed)"
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).
*********************************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top