Hi
I am trying to send an email with plain text, HTML text, an embedded image and an attachment.
Ignoring the plain text version of the email, I wish the embedded graphic to be at the top of the email, then the HTML text, and then have 1 attachment which can show at the bottom if the client email program has the option set to show attachments.
When I send the email without the final attachment the "header" graphic appears at the top of the HTML text only, great. However if I then add the final attachment the header graphic not only appears at the top but at the bottom too, along with the other attachment.
I do not know if this is a coding issue or whether the email client is being told to perform this way and is normal.
I am using the following code:
// Open new connection
$swift=new Swift(new Swift_Connection_SMTP('127.0.0.1',25));
// Setup message subject
$message=new Swift_Message("$subject_of_email");
// Add PLAIN TEXT data
$message->attach(new Swift_Message_Part("$body_of_email_plain"));
// Convert text to HTML format for the Line Breaks
$body_of_email_html=nl2br($body_of_email_html);
// Add header graphic
$img=new Swift_Message_Image(new Swift_File("../path/"."$graphic_id".".jpg"));
$src=$message->attach($img);
// Add Header Graphic and HTML version of text
$message->attach(new Swift_Message_Part("<img src=\"".$src."\"><br><br>$body_of_email_html","text/html"));
// Attach document to the email
$message->attach(new Swift_Message_Attachment(new Swift_File($path_to_use),"$fileatt_name","application/pdf"));
// Create empty Recipient list
$recipients=new Swift_RecipientList();
// Add recipient including a nice name
$recipients->addTo("$the_client_email","$the_client_name $the_client_surname");
// Send email to customer
$swift->send($message, $recipients, new Swift_Address($from_reply_address,"$nice_name"));
// Close the connection
$swift->disconnect();
Help with embedded image
Moderators: Chris Corbyn, General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Help with embedded image
This is normal, since to all intent and purpose, embedded images are attachments (just a special kind of attachment)
As you mention, it is client-specific however.
Re: Help with embedded image
Hi Chris
Many thanks for your reply. At least I know what I am seeing is normal.
Also, different subject completely, did you ever have time to sort out the issues with the Russian text? To refresh, we emailed each other about a problem I was having with Russian text and the "From:" field. Your latest build fixes the problem but introduced a problem into the "Subject" field. I last emailed you on 16.10.2007.
Oh, and I'm about to make a donation to your project, really, keep up the good work, it's fantastic.
Off now to read some more of your site to try and absorb some other commands to try and provide my code.
Andy.
Many thanks for your reply. At least I know what I am seeing is normal.
Also, different subject completely, did you ever have time to sort out the issues with the Russian text? To refresh, we emailed each other about a problem I was having with Russian text and the "From:" field. Your latest build fixes the problem but introduced a problem into the "Subject" field. I last emailed you on 16.10.2007.
Oh, and I'm about to make a donation to your project, really, keep up the good work, it's fantastic.
Off now to read some more of your site to try and absorb some other commands to try and provide my code.
Andy.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Help with embedded image
Quoted-printable encoding is completely fixed in version 4 (not finished yet). I support the following charsets currently (and plan on adding more):andyb wrote:Hi Chris
Many thanks for your reply. At least I know what I am seeing is normal.
Also, different subject completely, did you ever have time to sort out the issues with the Russian text? To refresh, we emailed each other about a problem I was having with Russian text and the "From:" field. Your latest build fixes the problem but introduced a problem into the "Subject" field. I last emailed you on 16.10.2007.
Oh, and I'm about to make a donation to your project, really, keep up the good work, it's fantastic.
Off now to read some more of your site to try and absorb some other commands to try and provide my code.
Andy.
ASCII
Windows-125*
ANSI
CP* (all codepage charsets)
UTF-8
UCS-2 / UTF-16
UCS4 / UTF-32
ISO/IEC-8859-*
Macintosh
ISCII / VISCII
Cork / T1
It's been implemented from scratch, all my own code, no silly innacurate regexes, following RFC 2045 to the letter
Unfortunately, it is slower (a lot slower right now) due to the fact it needs to be aware of characters... but I'll optmize the hell out of it before release. I already know I can increase the speed to 50% by adjusting the logic in one area.
Thanks ever so much for being kind enough to consider a donation too, much appreciated. I love end-users!
Re: Help with embedded image
Many thanks for the update. For now I am using version 3.2.6 as that means the "Subject:" works with Russian text, and for now I am using a set text in English for the "From:" field.
Look forward to trying the new version to see if it resolves the Russian text problem and the sometimes truncating of sentences onto new lines even in English.
Look forward to trying the new version to see if it resolves the Russian text problem and the sometimes truncating of sentences onto new lines even in English.