Search code examples
emailcoldfusionmacos-sierracoldfusion-2016

Sent email has content but it can't be seen


I am trying to send an email using new mail() and it almost works.

The email that gets sent has the desired content in the raw message, but Apple Mail (app) cannot read it.

Is this an Mail (Apple App) problem or a mail (ColdFusion object) problem?

Last but not least, ColdFusion is running on Windows 10

ColdFusion code

var mail = new mail();

mail.setFrom(application.EMAILFROM);
mail.setTo(arguments.email);
mail.setSubject(application.GSSITE_FULL_NAME & " Password Reset");
mail.addPart( type="plain", charset="utf-8", body="This is a test message." );
mail.send();    

Email Program results

enter image description here Raw Email

Return-Path: <no-reply@xxx.com>
Received: from 10.211.55.15 (cpe-76-169-198-102.socal.res.rr.com [76.169.198.102]) by mail.xxx.com with SMTP;
   Sat, 1 Jul 2017 19:41:27 -0700
Date: Sat, 1 Jul 2017 19:41:26 -0700 (PDT)
From: no-reply@xx.com
To: james@xxx.com
Message-ID: <65588416.79.1498963286429@mail.xxx.com>
Subject: xxx Password Reset
MIME-Version: 1.0
Content-Type: multipart/alternative; 
    boundary="----=_Part_78_1984282986.1498963286427"
X-Mailer: ColdFusion 2016 Application Server
X-SmarterMail-TotalSpamWeight: 0 (Authenticated)

------=_Part_78_1984282986.1498963286427
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

This is a test message.
------=_Part_78_1984282986.1498963286427
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit


------=_Part_78_1984282986.1498963286427--

Help

What is going on?


Solution

  • It's a known issue affecting all iOS devices. To avoid it, add an HTML part to your mail body:

    mail.addPart( type="plain", charset="utf-8", body="This is a test message."        );
    mail.addPart( type="html",  charset="utf-8", body="<p>This is a test message.</p>" );
    

    Make sure the plain part is added before the mail part as this is part of the issue.

    Why? Who knows? It's probably a combination of strictly following the SHALL/SHOULD/MAY's of the RFC and improper implementation on Apple's side.