email - Missing attachement in mail sent through Mime / SMTP Gmail Server (PHP, PEAR) -
i sending email server through smtp gmail using pear's mail mime. when add attachement not show up.
$smtpinfo["host"] = "ssl://smtp.gmail.com"; $smtpinfo["port"] = "465"; $smtpinfo["auth"] = true; $smtpinfo["username"] = "xxx"; $smtpinfo["password"] = "xxx"; $headers = array( 'from' => $from, 'to' => $to, 'subject' => utf8_decode($subject) ); $mime = new mail_mime(); $mime->sethtmlbody($html); $mime->addattachment("http://ww.url.of.a.file.that.exists.100percent.jpg", "image/jpeg"); $body = $mime->get(array('html_charset' => 'utf-8','charset' => 'utf-8')); $headers = $mime->headers($headers); $smtp = mail::factory('smtp', $smtpinfo); $mail = $smtp->send($to, $headers, $body);
everything works fine attachement entirely missing.. i've been googling hours.. appreciate hints..
my first thoughts check [boolean] response of addattachment method see if returns 'not found' or other type of indication(s)
$fileattached = $mime->addattachment("http://ww.url.of.a.file.that.exists.100percent.jpg", "image/jpeg"); echo ( !empty($fileattached) ) ? "attached successfully!" : "uh, houston?";
my initial thought it's expecting 'file' 'loca' system , not accessed via http, etc. and, if allow http access, might want check allow_url_fopen in .ini file insure it's set 'enabled' {"on" if looking @ phpinfo() result.
additional information on 'file' -
http://pear.php.net/manual/en/package.mail.mail-mime.addattachment.php
Comments
Post a Comment