[ZendTo] HTML Email
Jules
Jules at Zend.To
Thu Mar 9 10:59:25 GMT 2017
Karl,
I've thought of one problem of your approach: you should really put in
both text and HTML variants of the message to create a
multipart-alternative MIME message.
However, if there are any PHP libraries out there which will do the MIME
encoding for me, I can just add a template file for the HTML part of the
message, and build the entire MIME message from the text part (which we
already have in place) and the new HTML part. That allows for the
possibility of adding an image or two within the message as well.
If anyone out there fancies a quick dig for how to create multipart MIME
messages in PHP, please do let me know what you find.
Cheers,
Jules.
On 08/03/2017 18:58, Jules wrote:
> Karl,
>
> Me likes!
>
> That's simpler than what I originally had in mind, as you specifically
> are not embedding the image files. It does however mean that
> recipients who aren't displaying remote images have to click the
> "fetch the images" button in their mail client, which isn't *quite* as
> nice.
>
> But if people are happy to live with that as a compromise, I should be
> able to work this in very easily.
>
> BTW If you haven't spotted it yet, there's a bug in the way the "you
> haven't picked up your drop-off and it's about to expire" reminders
> are generated. Currently that means the URL to reach the download page
> is missing the "https://your-zendto.company.com/" off the front of it.
> So the links in the reminders don't work. The original messages sent
> out when the drop-off is created are fine, it's just the reminders
> when no one has picked up that drop-off at all, and it's about to expire.
>
> You can work around that by just hard-coding the start of the URL in
> dropoff_email.tpl.
> You need to replace "{$zendToURL}" with something like
> "https://zendto.your-company.com/" or whatever is appropriate for you.
>
> I'm thinking about a solution to this...
>
> Cheers,
> Jules.
>
>
> On 08/03/2017 18:43, Karl Bundy wrote:
>>
>> Jules,
>>
>> All I did was create the new email template, added a new function to
>> the NSSDropbox.php file (see below) based on the existing
>> deliverEmail function, then changed the NSSDropoff.php file to use
>> the new function and new template. I did not embed/attach the image
>> files, just set the URL in the HTML template. There are more
>> sophisticated ways to send HTML email, but the Mail function has the
>> basics to get the job done.
>>
>> //*!/
>> / @function deliverEmailHTML/
>>
>> / Send the $content of in an HTML formatted email message to (one or
>> more) address(es) in $toAddr./
>> /*//
>> /public function deliverEmailHTML(/
>> / $toAddr,/
>> / $fromAddr,/
>> / $subject,/
>> / $content,/
>> / $headers = ""/
>> /)/
>> /{/
>> /// If it contains any characters outside 0x00-0x7f, then encode it/
>> /if (preg_match('/[^\x00-\x7f]/', $subject)) {/
>> / $subject =
>> "=?UTF-8?B?".base64_encode(html_entity_decode($subject))."?=";/
>> /}/
>> /if (preg_match('/[^\x00-\x7f]/', $fromAddr)) {/
>> / $fromAddr =
>> "=?UTF-8?B?".base64_encode(html_entity_decode($fromAddr))."?=";/
>> /}/
>> /if (preg_match('/[^\x00-\x7f]/', $this->_emailSenderAddr)) {/
>> / $sender =
>> "=?UTF-8?B?".base64_encode(html_entity_decode($this->_emailSenderAddr))."?=";/
>> /} else {/
>> / $sender = $this->_emailSenderAddr;/
>> /}/
>>
>> /// Add the From: and Reply-To: headers if they have been supplied./
>> /if ($fromAddr!="") {/
>> / $headers = sprintf("From: %s", $sender) . PHP_EOL ./
>> / sprintf("Reply-to: %s", $fromAddr) . PHP_EOL ./
>> / $headers;/
>> /}/
>>
>> /// Add the MIME headers for 8-bit UTF-8 encoding/
>> /$headers .= "MIME-Version: 1.0".PHP_EOL;/
>> /$headers .= "Content-type: text/html; charset=iso-8859-1".PHP_EOL;/
>> /$headers .= "Content-Transfer-Encoding: 8bit".PHP_EOL;/
>>
>> /return mail(/
>> / $toAddr,/
>> / $subject,/
>> / $content,/
>> / $headers // JKF Commented out for now due to security concerns ,/
>> / // JKF Commented out for now due to security concerns/
>> / // '-f "'.$fromAddr.'"'/
>> / );/
>> /}/
>>
>> --- Karl
>>
>> *From:*zendto-bounces at zend.to [mailto:zendto-bounces at zend.to] *On
>> Behalf Of *Jules
>> *Sent:* Wednesday, March 08, 2017 11:19 AM
>> *To:* ZendTo Users <zendto at zend.to>
>> *Subject:* Re: [ZendTo] Use different AD attribute
>>
>> Karl,
>>
>> Yes, I agree this would be nice. I basically haven't had time to sort
>> it all out. As I need to make the message a multipart MIME structure,
>> the email templates get a *lot* more complicated.
>>
>> What did you have to change except for any templates/*.tpl files?
>> Any changes you make to the *.tpl files will *not* be overwritten
>> when you upgrade later.
>>
>> So any hints you've got as to what I need to change in order to
>> support the massively more complex MIME messages, please do let me know.
>>
>> Thanks!
>> Jules.
>>
>> On 22/02/2017 16:58, Karl Bundy wrote:
>>
>> Jules,
>>
>> Thanks for all of your ongoing work on ZendTo, it has been a huge
>> benefit for our team, and to the whole user community!
>>
>> A feature request that I would love to see is the option for HTML
>> formatted email notices. They give a bit of polish to the system
>> and oddly enough seem to give our users a bit more confidence in
>> the system. I have hacked our instance to send HTML formatted
>> emails (see screenshot below) and I while what I have works fine,
>> it would be great if this type of functionality was built-in to
>> the system so that I don’t have to add back this functionality
>> anytime we do upgrades.
>>
>> Thanks,
>>
>> Karl
>>
>> _______________________________________________
>>
>> ZendTo mailing list
>>
>> ZendTo at zend.to <mailto:ZendTo at zend.to>
>>
>> http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto
>>
>> Jules
>> --
>> Julian Field MEng MBCS CITP CEng
>> 'Once is happenstance, twice is coincidence, three times is enemy
>> action.' - Ian Fleming
>> www.Zend.To <http://www.Zend.To>
>> Twitter: @JulesFM
>> PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
>>
>> _______________________________________________
>> ZendTo mailing list
>> ZendTo at zend.to
>> http://mailman.ecs.soton.ac.uk/mailman/listinfo/zendto
> Jules
>
> --
> Julian Field MEng MBCS CITP CEng
>
> 'There is one thing stronger than all the armies in the world;
> and that is an idea whose time has come.'
>
> www.Zend.To
> Twitter: @JulesFM
> PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
Jules
--
Julian Field MEng MBCS CITP CEng
'Adversity is like a strong wind. I don't mean just that it holds
us back from places we might otherwise go. It also tears away from
us all but the things that cannot be torn, so that afterward we see
ourselves as we really are, and not merely as we might like to be.'
- Arthur Golden
www.Zend.To
Twitter: @JulesFM
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20170309/4e1add88/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 26857 bytes
Desc: not available
Url : http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20170309/4e1add88/attachment-0001.jpe
More information about the ZendTo
mailing list