Dnn.Platform
Dnn.Platform copied to clipboard
WebForms emails sending without Content-Type
Description of bug: When sending email forms from DNN site with - V.09.10.02 (0) - The issue we have found is that the new platform is now sending emails without specifying a content type so our paperless office platform we use that imports emails aren’t importing them correctly.
Working correctly:
DNN Version V.09.10.01 (0) sends emails with content type sending emails out of DNN
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64
X-PolicySMART: 15625892, 19897442, 25800812, 25818542
##Not working correctly: DNN Version V.09.10.02 (0) sends emails with MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=--boundary_1_8e9eeb69-7f8e-4938-8cd1-0eda79429901 X-PolicySMART: 15625892, 19897442, 25800812, 25818542
Affected version
v.09.10.02 (0)
When you send emails from DNN forms and it's imported into a paperless product the header doesn't include the Content-Type in version V.09.10.02 (0) the version right before V09.10.01 (0) works fine.
Can you define "From DNN Forms" DNN offers an emailing service to 3rd party modules but other than the system messages, if you have some form, this is probably a 3rd party module. Now I am not saying its just the module fault, but there has been move to make this built-in emailing service a provider and the old (CoreMailProvider) should stay on upgrades and the new (MailKitMailProvider) is available as an option you need to switch in the web.config (not sure if it gets set to it on new installs or not in v9.x.x. releases). The issue could be on the module level, the provider level or one of the two provider implementations having different defaults.
So to troubleshoot this, we need a full set of steps to reproduce including:
- How is the email created
- Which provider is configured right now (core or mailkit one in the web.config
In the web.config file here is the default provider
<mail defaultProvider="CoreMailProvider">
<providers>
<clear />
<add name="CoreMailProvider" type="DotNetNuke.Services.Mail.CoreMailProvider, DotNetNuke" hideCoreSettings="False" />
<add name="MailKitMailProvider" type="DotNetNuke.Services.Mail.MailKitMailProvider, DotNetNuke" hideCoreSettings="False" />
</providers>
</mail>
We are using DNNGo PowerForms and I have been in touch with them. They were the one to indicate that the emails where being sent from DNN without the Content-Type
Can they send a snippet of code on how they are doing it... We need proper steps (example) to troubleshoot this. Also as they are having an issue with this open source platform, they could also send a fix through a pull request as they probably know what the exact problem they are talking about... Can you refer them to this issue to see if they can have a more precise bug report or even simply submit the fix.
Mail.SendMail(MailFrom, mailInfo.MailTo, mailInfo.MailCC, mailInfo.MailBCC, mailInfo.ReplyTo, DotNetNuke.Services.Mail.MailPriority.Normal, mailInfo.Subject, MailFormat.Html, Encoding.UTF8, mailInfo.Content, AttachmentList, mailInfo.SMTPServer, mailInfo.SMTPAuthentication, mailInfo.SMTPUsername, mailInfo.SMTPPassword, SMTPEnableSSL);
Mail.SendMail(MailFrom, mailInfo.MailTo, mailInfo.MailBCC, mailInfo.Subject, mailInfo.Content, mailInfo.Attachments, "html", mailInfo.SMTPServer, mailInfo.SMTPAuthentication, mailInfo.SMTPUsername, mailInfo.SMTPPassword);
We will need a bit more code than this, we don't know what does variables contain, however please note that this method as been marked obsolete (deprecated). If memory serves good, because of moving from an hardcoded implementation to a provider model and the attachments amongst other things needed an abstraction to work with different providers.
https://github.com/dnnsoftware/Dnn.Platform/blob/3dadca3ece3483c35b67af26551e39c78f022072/DNN%20Platform/Library/Services/Mail/Mail.cs#L401
I would suggest either:
- Use the suggested replacement that takes a list of MailAttachments (for which you have more control over the content-type
- Use MailProvider using dependency injection, that way you get even more control over everything and work closer to the metal.
I think we might be getting off track. We used a different form tool to see if the issue was the module or the new DNN build - V.09.10.02 (0) - we used DNNSharp - action forms and had the same results as the DNNGo forms.
The difference is the way DNN version V.09.10.01 (0) verses the way V.09.10.02 (0) sends email.
( Our develpment site is still running on V.09.10.01 (0) - and the forms work correctly with our importers. ) This is the email header that is sent out. See the Content-Type specifies text/html ) Here is the site domain www.triangledev.com
DNN Version V.09.10.01 (0) sends emails with content type sending emails out of DNN MIME-Version: 1.0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: base64 X-PolicySMART: 15625892, 19897442, 25800812, 25818542
( Our production site has been upgraded to V.09.10.02 (0) and the email headers look like this. ) Here is the site domain www.triangleins.com
Notice that the Content-Type in the email header doesn't specify ( text/html ) ##Not working correctly: DNN Version V.09.10.02 (0) sends emails with MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=--boundary_1_8e9eeb69-7f8e-4938-8cd1-0eda79429901 X-PolicySMART: 15625892, 19897442, 25800812, 25818542
Something has changed on the way DNN is sending emails with the upgrade to V.09.10.02 (0)
I am no email expert but is it not normal for the content-type to be multipart at least with attachments ?
We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically. If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!
I was not able to reproduce this issue. I sent an HTML message using the very old Newsletters module and it is correctly multipart with a text/plain and a text/html parts.
It all looks fine to me. If that still happens, we will need some way to reproduce the issue like a very small module that makes the issue happen...