I have a strange circumstance which someone must have come across before.
I have built a website restricted to registered users. I have use the PasswordRecovery control to allow them to request a new password be emailed to them if they forget it.
This all works fine on the development server.
However, once I have deployed my website to my hosted server I am having problems.
When the user has an email registered on my hosting company's mail server, everything still works OK, but when the control tries to send an email to an external email address (i.e. everybody!) i get the following error:
Quote:
Mailbox unavailable. The server response was: <[email protected]> No such user here
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.SmtpFailedRecipientException: Mailbox unavailable. The server response was: <[email protected]> No such user here
|
my web.config is set up as follows:
<system.net>
<mailSettings>
<smtp>
<network host="mail.survey.juliabowes.com" port="25" userName="
[email protected]" password="*******" defaultCredentials="false"/>
</smtp>
</mailSettings>
</system.net>
and my PasswordRecovery control is set as:
<asp:PasswordRecovery ID="PasswordRecovery1"
runat="server"
SubmitButtonStyle-CssClass="Button">
<MailDefinition From="FromEmailAddress"
Subject="Your Survey password has been reset">
</MailDefinition>
</asp:PasswordRecovery>
I have spent days arguing with my hosting company that there is a relay problem with their mail server.
However, now I'm convinced that cant be the problem because I can send emails from a regular button control and configuring an email in codebehind as follows:
Imports System.Net.Mail
Dim mm As New MailMessage("FromEmailAddress", "ToEmailAddress")
mm.Subject = "test from survey.juliabowes"
mm.Body = "Hello World"
mm.IsBodyHtml = False
Dim thisSMTP As New SmtpClient
thisSMTP.Send(mm)
With no other code than this, i get an email OK which means that my host providers mail server is relaying the email fine.
The FromEmailAddress is exactly the same as the From in the PasswordRecovery control and the smtp settings can only be coming from Web.config as I havent set them anywhere else.
Therefore this CodeBehind and the PasswordRecovery control must be using the same mechanism for sending the mail.
Can anyone explain why I am having this problem, and what I need to do to set it up correctly?
Otherwise, any ideas for how to make a working version of the control.
Thanks.