473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 4251
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.