472,794 Members | 3,565 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 software developers and data experts.

problems by sending email with c# and web.config in a webserver Win 2003

Hi, this is my first time here, but I was looking for something that
may help me, and still, I haven't found something to use.

I'm using a website made in .NET with C#, when I'm running my site from
my PC, everything seems right, but when I publish the website, and send
it to my real website, everything works but the mail sending.

I have red some groups and topics, and everywhere I can found:
- Use the following syntax:
<system.net>
<mailSettings>
<smtp from="on******@yourdomain.com">
<network
host="smtp.yourdomain.com"/>
</smtp>
</mailSettings>
</system.net>
- Or other with some modifications:
<system.net>
<mailSettings>
<smtp from="on******@vyourdomain.com">
<network
host="smtp.yourdomain.com" userName="" password="" port="25"/>
</smtp>
</mailSettings>
</system.net>

Even without the port, it works on my PC, but in the real website, it
doesn't.

I'm not sure if something is missing, my local website is running on a
Windows XP professional edition, with .NET Framework 2.0, and the
website is on a Windows 2003 Server, with the .NET client installed.

Somewhere I red that .NET uses proxy configuration from IE, and I can
use IE in the webserver, but it does not use any proxy.

Also, I can send emails in other way, and THAT way is working anyway,
but this mail settings in the web.config file are showing an error
message.

I tried allowing the port in the firewall, but still nothing.

My questions are:

- Can I have this settings on this file working properly by doing
something in the server, or in the website?
- How can I check the commands sent by my website? Maybe if I can see
the real message, I can figure out a way to make it "recognized". (see
the error mesage below)
- Or, otherwise, can I avoid the mail settings in web.config? Because
when I tried to "avoid its use", by deleting the system.net section,
the website, in my PC, shows a message telling me that this section is
needed.
The error message obtained from the real website is the following:

Error: System.Net.Mail.SmtpException: Syntax error, command
unrecognized. The server response was: Unauthorized relay msg rejected
at System.Net.Mail.RecipientCommand.CheckResponse(Smt pStatusCode
statusCode, String response)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender,
MailAddressCollection recipients, String deliveryNotify,
SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at System.Web.UI.WebControls.LoginUtil.SendPasswordMa il(String
email, String userName, String password, MailDefinition mailDefinition,
String defaultSubject, String defaultBody, OnSendingMailDelegate
onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate,
Control owner)
at
System.Web.UI.WebControls.PasswordRecovery.Attempt SendPasswordUserNameView()
at System.Web.UI.WebControls.PasswordRecovery.Attempt SendPassword()
at System.Web.UI.WebControls.PasswordRecovery.OnBubbl eEvent(Object
source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
at System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEven t(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
By the way, sorry for misspellings, I'm not "english borned".

Thanks for your time, any suggestion or answer is welcome.

Jul 7 '06 #1
3 4204
This sounds to me like the mail server is rejecting your mail as being
relayed.

see http://www.systemnetmail.com/faq/1.4.aspx for what a relay server is

Most likely it is a setting on the mail server that needs to be changed (or
perhaps you are using the wrong mail server?)

Could you follow the following instructions to grab a log of the connection?
This will show you exactly what your webserver is sending to the email
server and what the email server sends back
http://www.systemnetmail.com/faq/4.10.aspx.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung
"armando perez" <ar******@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Hi, this is my first time here, but I was looking for something that
may help me, and still, I haven't found something to use.

I'm using a website made in .NET with C#, when I'm running my site from
my PC, everything seems right, but when I publish the website, and send
it to my real website, everything works but the mail sending.

I have red some groups and topics, and everywhere I can found:
- Use the following syntax:
<system.net>
<mailSettings>
<smtp from="on******@yourdomain.com">
<network
host="smtp.yourdomain.com"/>
</smtp>
</mailSettings>
</system.net>
- Or other with some modifications:
<system.net>
<mailSettings>
<smtp from="on******@vyourdomain.com">
<network
host="smtp.yourdomain.com" userName="" password="" port="25"/>
</smtp>
</mailSettings>
</system.net>

Even without the port, it works on my PC, but in the real website, it
doesn't.

I'm not sure if something is missing, my local website is running on a
Windows XP professional edition, with .NET Framework 2.0, and the
website is on a Windows 2003 Server, with the .NET client installed.

Somewhere I red that .NET uses proxy configuration from IE, and I can
use IE in the webserver, but it does not use any proxy.

Also, I can send emails in other way, and THAT way is working anyway,
but this mail settings in the web.config file are showing an error
message.

I tried allowing the port in the firewall, but still nothing.

My questions are:

- Can I have this settings on this file working properly by doing
something in the server, or in the website?
- How can I check the commands sent by my website? Maybe if I can see
the real message, I can figure out a way to make it "recognized". (see
the error mesage below)
- Or, otherwise, can I avoid the mail settings in web.config? Because
when I tried to "avoid its use", by deleting the system.net section,
the website, in my PC, shows a message telling me that this section is
needed.
The error message obtained from the real website is the following:

Error: System.Net.Mail.SmtpException: Syntax error, command
unrecognized. The server response was: Unauthorized relay msg rejected
at System.Net.Mail.RecipientCommand.CheckResponse(Smt pStatusCode
statusCode, String response)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender,
MailAddressCollection recipients, String deliveryNotify,
SmtpFailedRecipientException& exception)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at System.Web.UI.WebControls.LoginUtil.SendPasswordMa il(String
email, String userName, String password, MailDefinition mailDefinition,
String defaultSubject, String defaultBody, OnSendingMailDelegate
onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate,
Control owner)
at
System.Web.UI.WebControls.PasswordRecovery.Attempt SendPasswordUserNameView()
at System.Web.UI.WebControls.PasswordRecovery.Attempt SendPassword()
at System.Web.UI.WebControls.PasswordRecovery.OnBubbl eEvent(Object
source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
at System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEven t(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
By the way, sorry for misspellings, I'm not "english borned".

Thanks for your time, any suggestion or answer is welcome.

Jul 7 '06 #2
armando perez wrote:
Hi, this is my first time here, but I was looking for something that
may help me, and still, I haven't found something to use.

I'm using a website made in .NET with C#, when I'm running my site from
my PC, everything seems right, but when I publish the website, and send
it to my real website, everything works but the mail sending.
....
The error message obtained from the real website is the following:

Error: System.Net.Mail.SmtpException: Syntax error, command
unrecognized. The server response was: Unauthorized relay msg rejected
at System.Net.Mail.RecipientCommand.CheckResponse(Smt pStatusCode
statusCode, String response)
at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender,
MailAddressCollection recipients, String deliveryNotify,
....

Hi,
You have the problem with mail relaying. Mail relaying is when recipient
address does not reside on smtp server you connect (it is not local to
server). For example, if smtp server is smtp.domain.com, that server
will reject mails with recipient address other than so*******@domain.com
(eg. so*******@someotherdomain.com) . This is to prevent spam.

Internet providers usually allow relaying for authenticate user. My
does, because I use ADSL connection with authentication, so my providers
smtp server will accept emails to other domains and relay it. This is
because provider can always track emails to me in case of abuse. This
may explain why it works in your test lab.

You have two options:
1. Contact smtp server administrator and explain your situation, they
can allow relaying from your ip address.
2. Do a MX (mail exchanger) record DNS lookup on domain from email
address and deliver to one of smtp servers returned in response.
Regards,
Goran
Jul 7 '06 #3
Thank you for your answers in such a short time.

I will try the log to see what is happening, but it seems that my smtp
provider is the one that I should communicate with.

By the way, I'm still try with other mail sender, and is working now.

I avoid the sender from .NET in the file that was a "forgot password"
kind of, I don't know exactly what happen, but there was a
'CommandName="Submit"' that was trying to send the email with the
properties of web.config file, and that was showing the message.

I erase those words, and make some manual fix, because now, instead of
using the "templates" on .NET for "success", I need to redirect to a
success page.

I appreciate all your help, and I will see if I can set a communication
with my smtp provider, to see what happen, and how can we solve it to
use .NET in a better way.

Thank you all, and I hope this topic can help anyone else that has
something as I had.

Regards, every one!

Have a nice weekend!
(These words were typed on Friday.)

Jul 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Peter Blum | last post by:
I have built an assembly (dll) from which I expect third parties to subclass. As a result, when my assembly has a version change, it will cause any third party assembly based on it to break unless...
0
by: Nitec Dev | last post by:
Our setup: server1 ASP database running on IIS5, Outlook 2000 and SQL 2000 on Windows 2000. Server2 runs Windows 2000 with Exchange 2000 using CDO 1.2 MAPI Sessions. Clients use IE5/6 and had...
9
by: tshad | last post by:
This is a problem that we saw before on our asp site, but don't know how to fix it. We are seeing it on our .net site also. We have our email sending from our Windows 2003 server with exchange...
13
by: joe215 | last post by:
I want my users to send emails from a Windows app that I am developing in Visual Basic.NET 2003. I found a good example of sending email to a SMTP server using the SmtpMail class. However, using...
2
by: Gaz | last post by:
Hi all I am currently trying to send and email via exchange except I'm having a nightmare getting it working, you'd think this would be pertty simple wouldn't you? I have added a reference to...
25
by: n3crius | last post by:
hi, i just got a web host with asp.net , seemed really cool. aspx with the c# or vb IN the actual main page run fine, but when i use codebehind and make another source file ( a .cs) to go with...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
3
by: JaffaCakes | last post by:
I want to send an email confirmation after a user completes a form on our Internet page. I am testing this with the System.Web.Mail.SmtpMail class. If I do a SmtpMail.Send then the message takes...
0
by: senglory | last post by:
I wrote in web.config the following lines: <system.web> <customErrors mode="Off"/> </system.web>
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.