Portal Settings SMTP configuration fails in a localized site

Description

Although there are many issues reported here about SMTP settings but I couldn't find any which resemble mine in my localized site.

Steps:
1. Setup the Admin - Site - Advanced Settings - SMTP Server Settings in a properly localized site, e.g.:
SMTP Mode Portal: Host
SMTP Server and port: smtp.gmail.com:587
SMTP Authentication: Basic
SMTP Enable SSL: True (Checked)
SMTP Username: greensky@gazeta.pl
SMTP Password: ●●●●●●●● (note the number of dots masking the password: 8)

2. hit the "Test SMTP Settings" button to get the "Email Sent Successfully from greensky@gazeta.pl to admin@greg-greensky.net" at the top of the page.

3. hit the "Update" button and then the masked SMTP password gets changed to ●●●●●●●●●●●●●●●●●●●●●●●● (24 dots).

4. hit again "Test SMTP Settings" button to get the error at the top of the page like "There has been an error trying to send the test email. The error is: There is a problem with the configuration of your SMTP Server. Mail was not sent."

5. The error log says:

2015-01-22 00:50:25,456 [Anemone][Thread:22][ERROR] DotNetNuke.Services.Exceptions.Exceptions - System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, MailAddress from, Boolean allowUnicode) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at DotNetNuke.Services.Mail.Mail.SendMailInternal(MailMessage mailMessage, String subject, String body, MailPriority priority, MailFormat bodyFormat, Encoding bodyEncoding, IEnumerable`1 attachments, String smtpServer, String smtpAuthentication, String smtpUsername, String smtpPassword, Boolean smtpEnableSSL)

6. Expected result: the SMTP test succeeds after updating site settings
7. Actual result: the SMTP test fails due to a misconfiguration.

Remarks:

  • My site is dually localized and in the DB PortalSettings table there are two rows with SMTPPassword SettingName values: one for pl-pl and the other for en-US. Both hashed passwords are different but it's understandable.

  • However, the password after updating the SMTP Portal Setting gets mixed in some way and no longer works.

  • I don't have any such problems with HostSettings as there is only one SMTP setting in the database table and all works as expected and the number of dots in the masked password agrees with the number of characters in the password.

  • This issue appears to be gravely afflicting the administration of a localized site as the admins won't get informed e.g. about new user registrations, users won't get informed about successful changing their profiles or passwords.

QA Test Plan

None

Activity

Show:

Will MorgenweckDecember 12, 2016 at 11:47 PM

Batch update of issues that won't be addressed due to change in functionality from version 9.0

CodyOctober 30, 2015 at 6:16 PM

This should be AdministratorID Email instead of "hostEmail" for a test to work and also what should be used when sending out the emails. This is why I vote for having emails you can set for your accounts, admin, noreply, support, default check and so on. Only way this might work is if you use the same email domain for your email account used with the portal the same as the host. Which if your hosting multiple sites and don't desire emails to be coming from the same "Host" account. Portals should have better SMTP settings that help control mail. Servers usually are setup to send only from within that domains scope set by the domain after the @. So for my SMTP to work I need addresses that match the domain to be used while sending. anyemail@x.com cant send from a user with authentication that is anyemail@y.com using authenticatedemail@y.com. This is simply because this would open up the SMTP server to be used to spam.

One other issue is I am not able to use mail.domain.com:465 for SSL I have to leave the ports black to default to 25 to work and only works for host setttings.

If you look at the code below it shows what the "Test SMTP" button does. It sure looks like if I am looking at this correctly, but its using hostEmail for the email account. I could not find another version of testing SMTP so if your doing a portal test, this is the function you are using which is off. Again it should have something to do with the administrator of the websites email account, or an email account you can simply set as described above.

So by looking at this code and using two different domains, users with email accounts from different domains all hosting different websites using a single instance of DNN would run into an issue. Is there any way this has been tested and shown working using SSL having portal settings setup in the recent future?

To start this test method should probably be split into two with an If statement to tell if it is a host smtp or portal smtp. Maybe I am missing it? I would like to get to know this issue more to see what I can come up with to help troubleshoot at least.

protected void TestEmail(object sender, EventArgs e)
{
try
{
var hostEmail = Entities.Host.Host.HostEmail;
if (!String.IsNullOrEmpty(hostEmail))
{
txtSMTPPassword.Attributes.Add("value", txtSMTPPassword.Text);

string strMessage = Mail.SendMail(*hostEmail,
hostEmail,*
"",
"",
MailPriority.Normal,
Localization.GetSystemMessage(PortalSettings, "EMAIL_SMTP_TEST_SUBJECT"),
MailFormat.Text,
Encoding.UTF8,
"",
"",
txtSMTPServer.Text,
optSMTPAuthentication.SelectedItem.Value,
txtSMTPUsername.Text,
txtSMTPPassword.Text,
chkSMTPEnableSSL.Checked);
if (!String.IsNullOrEmpty(strMessage))
{
UI.Skins.Skin.AddModuleMessage(this, "", String.Format(Localization.GetString("EmailErrorMessage", LocalResourceFile), strMessage), ModuleMessage.ModuleMessageType.RedError);
}
else
{
UI.Skins.Skin.AddModuleMessage(this, "", Localization.GetString("EmailSentMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.GreenSuccess);
}
}
else
{
UI.Skins.Skin.AddModuleMessage(this, "", Localization.GetString("SpecifyHostEmailMessage", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError);
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}

CodyOctober 26, 2015 at 7:49 PM

This has been a long term issue since the portal feature was brought to DNN I have not seen it work yet.

There should be an option in the SMTP settings to set what email is used oh wait it does, but then uses the portals admin email instead of the email you set.

This seems to be the problem I am wanting to look hard into it now as I am hoping to get this feature working nicely. I want to host multiple sites from one installation but this is a show stopper.

I know that my SMTP server requires authentication (username/password) that matches the domain. If your administrator of the website uses something else it will fail.

It should simply use what you put inside for the account (or have an email field you can set for when the username is not an email account) and NOT use the administrators email. Have a way to set what email account is being used for registrations, passwords, newsletters along with a default for anything else if not everything.

Sebastian LeupoldOctober 23, 2015 at 9:47 AM

Greg,
if you are not in a multi-portal situation, where site specific SMTP settings are required, just use the Host configuration. This needs to be fixed in a future version though to suite multiportal scenarios.

Greg GreenskyOctober 23, 2015 at 9:44 AM

Sebastian, thanks for your attention. Again.

Yet, in my case I don't use the SMTPEnableSSL value so for me it is "N".

Additionally, if I set the SMTPMod*e to "*p" in Portal Settings DB Table my e-mails don't go to users. Only when I switch it back to "h" again, do they get emailed.

So the question is: whether I should stick to the f****-up setting as the manual says ("p" in SMTPMode in Portal Settings Table) and be deprived of the e-mailing functionality or should I use the "*h" there and enjoy the e-mailing capabilities.

For me the answer is obvious.

Won't Fix

Details

Assignee

Reporter

Story Size

Unknown

Severity

Major

Triage

Triaged

Reported in Build #

Includes Code Fix

No

Components

Affects versions

Priority

Created January 22, 2015 at 2:47 PM
Updated December 12, 2016 at 11:47 PM
Resolved December 12, 2016 at 11:47 PM