Hi!
Ok, I have tried every pssible way to make this possible but it looks like im running in to cercles...
My script simply doesnt want to send embaded logo... It wants to send it as an image like <img src="http'//..." />
but than i have problem with viewing the email because client has to download image every time (Outlook 2010/2013) For me it wouldnt be a problem but some clients find it anoying... Can enyone help me? This is my code
global $dal;
$dal_TableName = $dal->Table("table");
$body="";
foreach(@$keys as $keyblock)
{
$arr=explode("&",refine($keyblock["id"]));
if(count($arr)<1)
continue;
$arr2=array();
$arr2["id"]=urldecode(@$arr[0]);
$where = KeyWhere($arr2);
$rstmp = $dal_TableName->Query($where,"");
$datatmp=db_fetch_array($rstmp );
$body .= "
<html>
<head>
<style type='text/css'>
table.email {
border-width: 1px;
border-spacing: 2px;
border-style: outset;
border-color: #cccccc;
border-collapse: collapse;
background-color: white;
}
table.email td {
border-width: 1px;
padding: 5px;
border-style: inset;
border-color: #cccccc;
background-color: white;
-moz-border-radius: ;
}
</style>
</head>
<body>
<table ><tbody><tr><td>
<img src='http://domain.com/images/logo.gif' width='205' />
</td></tr>
</tbody></table>
</body>
</html>
";
}
// send the email
$email= "";
$from = "";
$subject="JOB STATUS UPDATE";
$arr = runner_mail(array('to' => $email, 'from' => $from, 'subject' => $subject, 'htmlbody' => $body, 'charset' => 'UTF-8'));
$result["txt"] = "Email is sent.";
// if error happened print a message on the web page
if (!$arr["mailed"])
{
$errmsg = "Error happened: <br>";
$errmsg.= "File: " . $arr["errors"][0]["file"] . "<br>";
$errmsg.= "Line: " . $arr["errors"][0]["line"] . "<br>";
$errmsg.= "Description: " . $arr["errors"][0]["description"] . "<br>";
$result["txt"] = $errmsg;
}
Any ideas would be helpful.. I found soo manny tutorials and info how it should be done but none of the things work.. Tried base64 encode and directly placed the encoded image but no luck...
This code however, works...
$to = '';
$subject = 'PHP Mail Attachment Test';
$bound_text = "test";
$bound = "--".$bound_text."\r\n";
$bound_last = "--".$bound_text."--\r\n";
$headers = "From: admin@server.com\r\n";
$headers .= "MIME-Version: 1.0\r\n"
."Content-Type: multipart/mixed; boundary=\"$bound_text\"";
$body .= "If you can see this MIME than your client doesn't accept MIME types!\r\n"
.$bound;
$body .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n"
."Content-Transfer-Encoding: 7bit\r\n\r\n"
."<img src=\logo.gif\" />\r\n"
."<table><tbody>\r\n
<tr><td>sdfsdfsdf</td></tr>\r\n
<tr><td>sdasdsadasda</td></tr>\r\n
</tbody></table>\r\n
"
.$bound;
$file = file_get_contents("http://domain.com/logo.gif");
$body .= "Content-Type: image/gif; name=\"logo.gif\"\r\n"
."Content-Transfer-Encoding: base64\r\n"
."\r\n"
.chunk_split(base64_encode($file))
.$bound_last;
if(mail($to, $subject, $body, $headers))
{
echo 'MAIL SENT';
} else {
echo 'MAIL FAILED';
}
but i can nooot get first one to work... if i try to mix it together i get whole email encoded...
Anny ideas would help me allot!
Thank you!