MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Server does not support secure connections error on registration.  (Mono Support )

Viewed 59195 time(s), 7 post(s) 8/7/2013 8:52:46 AMby mev9669
mev9669

mev9669

8/7/2013 8:52:46 AM
Hi,

I receive an error when a user tries to register on the site. Please see the error below..
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Server Error in '/' Application.Server does not support secure connections.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: Server does not support secure connections.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: 

[SmtpException: Server does not support secure connections.]
System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) +1443335
System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) +170
System.Net.Mail.SmtpClient.GetConnection() +44
System.Net.Mail.SmtpClient.Send(MailMessage message) +1852
MonoSoftware.Core.Mail.MailSender.SendMail(MailMessage mailMsg) +149

[ApplicationException: An error has occured while sending you an e-mail. Please try again, if the problem persists, please contact us.]
MonoSoftware.MonoX.Mail.MonoXMailSender.SendMail(MailMessage mailMsg) +75
MonoSoftware.Core.Mail.MailSender.SendMail(MailAddress fromAddress, String toAddress, String title, String htmlContent, String plainContent) +454
MonoSoftware.Core.Mail.MailSender.SendMail(String toAddress, String title, String htmlContent, String plainContent) +65
MonoSoftware.MonoX.ModuleGallery.MembershipEditor.#Jp(Object sender, EventArgs e) +1058

[ApplicationException: An uexpected error has occured while sending you an activation e-mail. Your account has been successfully created but you can't login until you activate it via activation e-mail. To resend your activation e-mail please go to the <a href="/Membership/ActivationEmailRecovery.aspx">Activation e-mail recovery</a> page. If the problem persists, please contact us.]
MonoSoftware.MonoX.ModuleGallery.MembershipEditor.#Jp(Object sender, EventArgs e) +1232
MonoSoftware.MonoX.Controls.StyledButton.OnClick(Object sender, EventArgs e) +28
MonoSoftware.MonoX.Controls.StyledButton.#Ho(Object sender, EventArgs e) +23
System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +91
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +91
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +169
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3260

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I created a custom contact us page and used the following code to send the emails. And the emails are delivered fine.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
protected void SendMail()
        {

            // any address where the email will be sending
            var toAddress = YourEmail.Text.ToString();
            //Password of your gmail address
            const string fromPassword = "Password";
            // Passing the values and make a email formate to display
            string body = "From: " + YourName.Text + "\n";
            body += "Email: " + YourEmail.Text + "\n";
            body += "Subject: " + YourSubject.Text + "\n";
            body += "Question: \n" + Comments.Text + "\n";
            string fromEmail = "support@.....com";

            MailMessage mail = new MailMessage(fromEmail, "admin@.....com");
            mail.Subject = YourSubject.Text.ToString();
            mail.Body = body;
            mail.IsBodyHtml = true;
            mail.BodyEncoding = System.Text.Encoding.UTF8;
            try
            {
                DisplayMessage.Visible = true;
                SmtpClient smtpClient = new SmtpClient();
                NetworkCredential oCredential = new NetworkCredential("admin@.....com", "fsdfsdfsd");
                smtpClient.UseDefaultCredentials = false;
                smtpClient.Credentials = oCredential;
                smtpClient.Send(mail);
                DisplayMessage.Text = "Thank you. We have recieved your query and will get back to you shortly.";
               
            }
            catch (Exception ex)
            {
                DisplayMessage.Text = ex.Message;
            }
        }

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If this was an issue with server then I believe none of the emails would have been sent out..
This content has not been rated yet. 
515 Reputation 67 Total posts
khorvat

khorvat

8/7/2013 1:10:47 PM
Hi,

  did you check your web.config for SMTP SSL setting as it seems that you are trying to connect to SMTP via secure connection ?
Exception Details: System.Net.Mail.SmtpException: Server does not support secure connections.
Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
mev9669

mev9669

8/7/2013 3:10:23 PM
this are the mail settings I have in the web.config file 

<mailSettings>
      <smtp deliveryMethod="Network" from="admin@sadsadas.com">
        <network host="mail.sadsadas.com" userName="info@sadsadas.com" password="sadsadas#" enableSsl="false"  defaultCredentials="true" />
      </smtp>
    </mailSettings>
This content has not been rated yet. 
515 Reputation 67 Total posts
mev9669

mev9669

8/8/2013 8:10:39 AM
Is there anything else that i need to add/change?
This content has not been rated yet. 
515 Reputation 67 Total posts
khorvat

khorvat

8/8/2013 9:29:48 AM
Hi,

please check the following

- you need to have the following setting set to false "<add key="EnableSmtpSSL" value="false"/>"
- if you have specified the username and password then you have to set the defaultcredentials to false
<network host="mail.sadsadas.com" userName="info@sadsadas.com" password="sadsadas#" enableSsl="false"  defaultCredentials="false" />
- is your SMTP server using standard ports or does it have some custom ports set for smtp protocol ?
e.g. <network defaultCredentials="false" host="smtp.gmail.com" port="587" userName="name@gmail.com" password="pass"  />
Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
mev9669

mev9669

8/8/2013 9:55:47 AM
Hi Khorvat

Thanks a lot. This finally got my problem solved. it will really helpful if you add this to your documentation.

This content has not been rated yet. 
515 Reputation 67 Total posts
khorvat

khorvat

8/8/2013 10:15:46 AM
If you are talking about the web.config smtp settings excerpt then I have to say that this isn't a MonoX setting but rather a ASP.NET setting and it is well documented in MSDN.

Let me know if you need anything else.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts