I would suggest an improvement to the type of email format

64 views
Skip to first unread message

miguel segura

unread,
Jun 13, 2012, 6:03:35 PM6/13/12
to cakephp-core
in the file CakeMail.php

function getHeaders () has the following code to change the format of
the email in line 666.

if (empty ($ this-> _attachments) | | $ this-> _emailFormat ===
'both') {
$ headers ['Content-Type'] = 'multipart / mixed; boundary = "'. $ this-
> _boundary. '"';
} elseif ($ this-> _emailFormat === 'text') {
$ headers ['Content-Type'] = 'text / plain; charset ='. $ this->
charset;
} elseif ($ this-> _emailFormat === 'html') {
$ headers ['Content-Type'] = 'text / html; charset ='. $ this->
charset;
}

suggest adding a calendar format

if ($ this-> _emailFormat === 'ics') {
$ headers ['Content-Type'] = 'text / calendar; charset ='. $ this->
charset;
}

remaining

if (empty ($ this-> _attachments) | | $ this-> _emailFormat ===
'both') {
$ headers ['Content-Type'] = 'multipart / mixed; boundary = "'. $
this-> _boundary. '"';
} elseif ($ this-> _emailFormat === 'text') {
$ headers ['Content-Type'] = 'text / plain; charset ='. $ this->
charset;
} elseif ($ this-> _emailFormat === 'html') {
$ headers ['Content-Type'] = 'text / html; charset ='. $ this->
charset;
} elseif ($ this-> _emailFormat === 'ics') {
$ headers ['Content-Type'] = 'text / calendar; charset ='. $ this-
> charset;
}

mark_story

unread,
Jun 17, 2012, 8:02:08 PM6/17/12
to cakeph...@googlegroups.com
Isn't a text/calendar just going to be a secondary part to either a text/plain or a text/html email though?  It seems like the kind of thing that could be better handled as an attachment with the current system.  Instead of adding another hardcoded type, we might want to consider making the types a more flexible name => mimetype mappings that developers can control for their needs, and start off with a good set of commonly used ones.

-Mark

Andy Hobbs

unread,
Jun 18, 2012, 5:08:36 AM6/18/12
to cakeph...@googlegroups.com
Hi,

The calendar info has to be the main body content of the email also for outlook and other mail programs to work correctly with them (especially to get the invite/response functions working correctly) the content type of the email itself has to be text/calendar also the line length of the email is critical and suitable line folding has to occur otherwise most email/calendar programs will fail to read the calendar appointment.

I've started writing a calendar component which will address these issues, but it is likely to be a couple of months before I can get back to that project.

Andy

Andy Hobbs

unread,
Jun 18, 2012, 5:10:27 AM6/18/12
to cakeph...@googlegroups.com
Also...

the content type header has to include other information too:


$calendarHeaders = array(
                'Content-Class' => 'urn:content-classes:calendarmessage',
                'Content-Type' => 'text/calendar; method=PUBLISH; charset=UTF-8',
                'Content-Transfer-Encoding' => '8bit'
        );
Reply all
Reply to author
Forward
0 new messages