Saturday, August 20, 2011

Re: Email Question

Looks as though you are there with your concept, but thought you may
like to read about how I approached this when wanting to log mulitple
reads for each email sent.

My method was to create a hash for every email sent. Then in the HTML
emails I included an image with a src of '/EmailMessageRead/add/
hash'.

In the controller action I first checked if the hash existed in my
table, if not I blackholed the request in an attempt to stop the
creation of random read requests.

If the hash did exist, I checked if there had been any previous reads
linked to this email and retrieved the last one. The idea here was to
check if there had been a read in the last XX minutes to try and limit
duplicate reads from a recipient navigating through their email client
and it repeatedly previewing their email. So if there were no
previous requests or the last request was more than 10 minutes ago I
saved an EmailMessageRead record.

I then simply ran a $this->redirect('http://www.witmail.co.uk/img/
beacon.gif
'); to redirect the request to my beacon image.

In addition to the above I also included a link in the HTML and Plain
Text emails to view the email online (if you are having problems
viewing this email type link) and linked this to the same action with
a $browserview boolean parameter which told the action to register a
message read (along with a flag to say it was a browser view) but
instead of redirecting to the beacon image it simply showed the email
content.

HTH, Paul.

On Aug 20, 7:01 am, Matt Murphy <mattyh...@gmail.com> wrote:
> Perfection.  Well, as much perfection as we're allowed, anyway.  Maybe
> tack on a BS image extension to the messageID that you lop off before
> processing in order to complete the illusion.  I am quite sure that
> will be permissible with default a default .htaccess file.
>
> Oh, the call to get the image.  We need actual image file contents and
> a proper image header:
> in the action:
> $this->view->image = file_get_contents($realimageURL);
> I may be hosing that object reference.  Get the file contents into a
> view object property.  Sorry, I'm rusty on my cakephp.
> ...and then maybe a view with the following might do it:
> <?php header('content-type: image/[imagetype]');?><?=$this->image?>
> but i may be wrong about being able to set the header in the view. so
> you may just want to cheat and do:
> (in the action again)
> header('content-type: image/png'); //assuming png image here
> echo file_get_contents($realimageURL); //whatever that is -- this will
> be a live web url
> exit;
>
> which is maybe a little kludgy, but will absolutely positively maybe work.
>
> M
> On Sat, Aug 20, 2011 at 12:28 AM, Krissy Masters
>
>
>
>
>
>
>
> <naked.cake.ba...@gmail.com> wrote:
>
> > Yeah I figured with all the email clients security settings saying "click here to download images in the message" type stuff there is no guarantee the image would be pulled. But for now some information on the ones who do is better than none at all.
>
> > So my next question is how do I go about this? How do I turn the fetching of an image into a function thru the url? something like this in the HTML email <img alt="" src="www.site.com/images/fetch/$message_id">
>
> >  and then that url would hit message controller
>
> > fetch($message_id ){
>
> > do the record keeping based on the message id
>
> > return '/images/the_image.jpg';
>
> > }
>
> > Am I far off here?
>
> > Thanks everyone,
>
> > K
>
> > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Matt Murphy
> > Sent: Friday, August 19, 2011 7:12 PM
> > To: cake-php@googlegroups.com
> > Subject: Re: Email Question
>
> > In an HTML layout, you can reference an image calling to a unique image URL.  When that gets hit in your logs, you know they opened it.  Unfortunately, they might not display images, because this is a classic way to confirm that an email is active employed by spambots, but it's the best *automatic* method I know of.
>
> > I'm eager to hear what everyone else has!
>
> > Matt Murphy
>
> > On Fri, Aug 19, 2011 at 5:15 PM, Krissy Masters <naked.cake.ba...@gmail.com> wrote:
>
> > I am sending out emails and I want to know that the person has opened it. How does one go about this? I have a link in the email they can click to view in browser and I can tell when that happens but as for straight email viewing I'm stumped.
>
> > Not much detail in the question but I figure its rather straight to the point J
>
> > Thanks everyone as I wait in anticipation for any help.
>
> > K
>
> > --
> > Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: