Saturday, August 24, 2013

Email headers

Is there a way to spoof emails (CakeEmail) sent from the server to appear to be coming from Outlook for example?

 

Examining the headers it shows "Sent from online application" which I think is causing some problem for my situation.

I used to be able to send reply's to online postings using my backend email sender function. It works on any individual domain like you@where.com and other sites all except for Craigslist.

 

I even set up a new gMail account to test it but nothing appears to be going thru as that is the only never to get a response.

 

I even went as far as creating a fake ad on CL and sent reply's to myself using the new gMail and never got any.

 

So all I can conclude is the reply's need to be sent from an actual email client. And not from an online application / script.

 

Email.php snip

 

public $dave = array(

                'transport' => 'Smtp',

                'from' => array('dave@*****.com' => 'Dave Maharaj),

                'replyTo' => 'dave@*****.com',

                'host' => 'localhost',

                'port' => 26,

                'timeout' => 30,

                'username' =>'myusername',

                'password' => 'myPassword',

                'charset' => 'utf-8',

);

 

And the sendMail function from a controller:

 

private function sendEmail($data){

                               

                App::uses('CakeEmail', 'Network/Email');

                $email = new CakeEmail('dave');

                $email -> to($data['User']['email']);

                $email -> subject($data['Reply']['post_title'] . ' Posting');

                $email -> setHeaders(array('X-Mailer' => 'PHP ' . phpversion()));

                $email -> template('reply', 'default');

                $email -> emailFormat('html');

                $email -> viewVars(array('data' => $data));

                $email -> send();

                               

}

 

It works perfect for anything other than Craigslist.

 

Thanks,

 

Dave

 

No comments: