Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.
Moderators: Chris Corbyn , General Moderators
edu
Forum Newbie
Posts: 5 Joined: Tue Feb 26, 2008 6:22 pm
Post
by edu » Tue Feb 26, 2008 6:28 pm
Hi everyone ... i'm using swift for long time .. but when i tryed to make automatic embedder work ... i got problem ..
Code: Select all
$myHTMLbody = ' <img width="136" height="160" alt="" src="/imagens/sony-television_pop.jpg" /> <br /> <img src="http://forums.devnetwork.net/styles/subsilver2/imageset/site_logo.gif">
<br />
<br />
testing';
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
require_once "lib/Swift/Plugin/FileEmbedder.php";
$swift =& new Swift(new Swift_Connection_SMTP("localhost"));
$plugin =& new Swift_Plugin_FileEmbedder();
//Attach the plugin
$swift->attachPlugin($plugin, "file_embedder");
$message =& new Swift_Message($mysubject);
$message->attach(new Swift_Message_Part($myHTMLbody, 'text/html'));
$swift->send($message, 'myemail@gmail.com', 'myemail@gmail.com');
its simple ignore the plugin and still show image in body and link "click here to activate"
tested with latest v3 and no work !
ideas ? thx
edu
Forum Newbie
Posts: 5 Joined: Tue Feb 26, 2008 6:22 pm
Post
by edu » Sun Mar 02, 2008 1:13 pm
nothing ?
edu
Forum Newbie
Posts: 5 Joined: Tue Feb 26, 2008 6:22 pm
Post
by edu » Sun Mar 02, 2008 1:24 pm
recevied email
Code: Select all
--_=_swift-100065544547c4b4d361c577.30601800_=_
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
<img width="136" height="160" alt="" src="/imagens/sony-television_pop.jpg" /> <br /> <img src="http://forums.devnetwork.net/styles/subsilver2/imageset/site_logo.gif">
<br />
<br />
testing
--_=_swift-100065544547c4b4d361c577.30601800_=_--
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Sun Mar 02, 2008 3:03 pm
Sorry I must hav missed this thread. I suspect it'll be a regex issue in my code but I'll have a closer look when I get to work
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Sun Mar 02, 2008 5:54 pm
Do you know what version of Swift you have? This should have worked fine I think. Hmm...
edu
Forum Newbie
Posts: 5 Joined: Tue Feb 26, 2008 6:22 pm
Post
by edu » Mon Mar 03, 2008 11:10 am
i tested on 3.2.6 and 3.3.2
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Mon Mar 03, 2008 6:24 pm
Hmm... do you actually have a file here?
/imagens/sony-television_pop.jpg
/ refers to the root of the server, not to your web root. Perhaps that path is wrong?
The http:// issue could be down to allow_url_fopen() being disabled on your host.
What does this show?
Code: Select all
echo (int) ini_get('allow_url_fopen');
edu
Forum Newbie
Posts: 5 Joined: Tue Feb 26, 2008 6:22 pm
Post
by edu » Tue Mar 04, 2008 6:29 pm
ok .. url fopen is disabled ...
but with local images .. i should use img src="../images/coolpicture.jpg" or src="images/coolpicture.jpg" or src="
http://mysite.com/images/coolpicture.jpg " ??
i will enable url fopen with htaccess and i tell you what i got
using ini_set to allow url fopen and using src="
http://mysite.com/a.jpg "
now i dont have much time to test local files .. anyway TY for help me
Code: Select all
--_=_swift-204907324047cde9efc93502.29830309_=_
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
This is going to be embedded<br />
<img src="a.jpg" /> <img src="cid:swift-120467710347cde9efc7cf3.0@mysite.com.br" /> rather than linked to.
--_=_swift-204907324047cde9efc93502.29830309_=_--
Last edited by
edu on Tue Mar 04, 2008 6:44 pm, edited 1 time in total.
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Tue Mar 04, 2008 6:40 pm
For local images I cannot possibly answer without knowing where the image is. You just need to reference the image relative to where the script is being run from.