The correct way to send ASP.NET email?


I have tried about every way possible, but nothing seems to work this time.

What is the correct way to send mail from a Jodo .NET web server?

Currently, I have the following in my web.config:

                <network host="" userName="[email protected]" password="mypassword" defaultCredentials="false" port="587" />

The "noreply" user is a valid user, using the specified login credentials.

This particular client runs their email through Google Apps. It is my understanding that we can't authenticate to Google Apps from Jodo because we cannot run .NET web apps in full trust mode due to shared hosting. Google Apps requires a secure connection, which is not available in our trust mode. For this reason, I created a subdomain for this account called "service". The only reason for this domain is to send out email, hence the references to "service" in the above web.config excerpt.

Then, in my mail code, I'm calling the SMTP object like so:
SmtpClient mSmtpClient = new SmtpClient();
mSmtpClient.Send(mMailMessage); //where nMailMessage uses "[email protected]" as the from address

I'm receiving the following error:
Mailbox name not allowed. The server response was: sorry, that domain isn't allowed to be relayed thru this MTA (#5.7.1)

Any ideas?

Looks user name is not correct. Try to use noreply at instead of noreply at
Yes, that was actually a typo. I changed it in the code right after posting it. Good catch, though. Assuming it was actually logging in with that username/pwd, I'm assuming it would give me an authentication failure, correct?
Ah, I was looking at the wrong place. You're right. It was using the wrong username.

Thanks for your help. Problem solved.