HTMLmail: Embedding images with id

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

Post Reply
uyuni
Forum Newbie
Posts: 7
Joined: Wed Feb 11, 2009 12:05 pm

HTMLmail: Embedding images with id

Post by uyuni »

Is this a bug or am I doing something wrong?

According to the manual I can use:

Code: Select all

$src = $message->attach($swift_image, $id);
The second parameter should be:
# string $id: An identifier to use (one is returned otherwise)

But the returnvalue always has a newly generated id, not the one I gave as 2nd parameter!

I'd like to define the id myself so I can use a template for the HTML with the image-src already in the template.

Emilio
uyuni
Forum Newbie
Posts: 7
Joined: Wed Feb 11, 2009 12:05 pm

Re: HTMLmail: Embedding images with id

Post by uyuni »

I already found how to do it.
The id has to be entered in the Swift_Message_Image class:

Code: Select all

$swift_img =& new Swift_Message_Image(new Swift_File($path), $filename, "application/octet-stream", $id);
 
Post Reply