missing images with file embedding plugin
Posted: Fri Jun 22, 2007 5:57 am
feyd | Please use
And this is my php code.[/syntax]
Any idea ? 
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hello again
This time my images are misteriously disappearing during the process.
This is my test email (of course there is a "1.jpg" image inside my test folder.
[syntax="html"]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<img src="1.jpg" width="670" height="231" />
</body>
</html>Code: Select all
<?php
//----------------------------------------------
//DEFINIZIONI INIZIALI
$from = "info-easynet@skf.it"; //mittente email
$nominativo = "name"; //nominativo del mittente, appare nel FROM:
$oggetto = "subject"; //oggetto
//----------------------------------------------
error_reporting(E_ALL);
ini_set("display_errors", "On");
//load address from external file
$filename = "indirizzi.txt";
$handle = fopen($filename, "rb");
$contents = fread($handle, filesize($filename));
fclose($handle);
echo "contenuti:".$contents;
$indirizzi = explode("\n", $contents);
//load newsletter from file
$filename = "newsletter.html";
$handle = fopen($filename, "rb");
$newsletter = fread($handle, filesize($filename));
fclose($handle);
//text only version newsletter
$filename = "newsletter.txt";
$handle = fopen($filename, "rb");
$textonly = fread($handle, filesize($filename));
fclose($handle);
// single quota replacer
$newsletter= str_replace(chr(39), chr(146) , $newsletter);
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
require_once "lib/Swift/Plugin/Throttler.php";
require_once "lib/Swift/Plugin/FileEmbedder.php";
//Attach the plugin
$smtp =& new Swift_Connection_SMTP("my own mail server", 25);
$swift =& new Swift($smtp);
$swift->log->enable();
//Attach the plugin
$swift->attachPlugin(new Swift_Plugin_FileEmbedder(), "file_embedder");
$throttler =& new Swift_Plugin_Throttler();
$throttler->setEmailsPerMinute(100); //Max of 1 email every 2 seconds
$message =& new Swift_Message($oggetto);
$message->attach(new Swift_Message_Part($newsletter, 'text/html'));
$recipients =& new Swift_RecipientList();
foreach ($indirizzi as $value) {
$recipients->addTo($value); //or we can just add the address
//echo "-".$value."<br>";
echo "<pre>indirizzo:".$value."</pre>";
}
// formato dell'invio: corpo del messaggio, lista dei destinatari, indirizzo e nome del mittente.
$swift->batchSend($message, $recipients, new Swift_Address($from,$nominativo));
//recommended to do this
$swift->disconnect();
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]