HTML Email Templates, and extending functionality

Permalink
A client requested that the emails they receive from contact forms be styled in HTML with their logo - along with also sending the user a confirmation email to say that their form submission had been received. The latter doesn't exist as far as I can see, so I overrode the controller with the following:

<?php  
namespace Application\Block\Form;
defined('C5_EXECUTE') or die("Access Denied.");
use Loader;
use User;
use Page;
use UserInfo;
use Exception;
use Concrete\Block\Form\Controller as FC;
class Controller extends FC
{
   public function action_submit_form()
   {
      // Get the initial value of the redirect piece
      $noSubmitFormRedirect = $this->noSubmitFormRedirect;


I've pasted the entirety of it here in case it helps someone - it retains the full functionality of the form piece, but just adds the ability to send them a confirmation email. As such I pass through a template, that I created in the "application/mail" folder, which contains normal and HTML body email content

<?php  
defined('C5_EXECUTE') or die("Access Denied.");
$body = t("
Thank you for contacting us. We'll be in touch soon.
");
$bodyHTML = t("
<p>Thank you for contacting us. We'll be in touch soon. (HTML Version)</p>
");


However, whenever this email sends (and the normal email, of which I added the "$bodyHTML" parameter to), it sends and renders both content pieces in the resulting email. Is there something wrong in my mail template logic, or something wrong in the sender method? OR is it just a problem with gMail interpreting and rendering both?

Thanks,

Dan

View Replies:
Danives replied on at Permalink Reply
Looking at the source of the email sent, I wonder if it is just gmails settings, as it is distinctly set in two parts

Content-Type: multipart/mixed;
 boundary="=_b522f7bdff36e32519072c2cd3c7da32"
...
--=_b522f7bdff36e32519072c2cd3c7da32
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Thank you for contacting us. We'll be in touch soon.
--=_b522f7bdff36e32519072c2cd3c7da32
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<p>Thank you for contacting us. We'll be in touch soon. (HTML Version)</p>
--=_b522f7bdff36e32519072c2cd3c7da32--


Anyone encountered this before?