Page 1 of 1

Releative Newbie

Posted: Fri Jul 31, 2009 6:18 am
by wedmonds
Hi Guys,

I am relatively new to PHP and I am creating an e-mail that will confirm to customers what they have purchased.

Could someone advise on how I go about telling the script to include a specific company logo hosted on a remote site?
(the sort of thing you get from itunes as confirmation on your purchase would be ideal)

I would welcome any views or comments on the best way to achieve this.

Thanks all

wedmonds

Re: Releative Newbie

Posted: Fri Jul 31, 2009 6:24 am
by jackpf
So you just want images in your email?

You'll need to send the correct headers, such as mime type, content version etc.

This might be of some use.

Re: Releative Newbie

Posted: Fri Jul 31, 2009 6:33 am
by wedmonds
Thanks for reply.
I was on the right lines. I decided to use the following:

$headers .= "X-Mailer: PHP\r\n";
$headers .= "Mime-Version: 1.0\n";
$headers .= "Content-Type: text/html; charset=utf-8\n";
$headers .= "X-Priority: 1\r\n";

Is it then a simple case of adding <img src="http://www.example.com/logo.jpg" alt="logo" /> ???

sorry! :banghead:

Re: Releative Newbie

Posted: Fri Jul 31, 2009 6:37 am
by jackpf
I believe so. I've never sent html with the mail() function, so I'm not entirely sure.

The only way to find out is to test it and see! :)

Re: Releative Newbie

Posted: Fri Jul 31, 2009 6:40 am
by wedmonds
ok, thanks for your help..... :)

Anyone else able to comment?

Re: Releative Newbie

Posted: Fri Jul 31, 2009 12:07 pm
by pickle
I'd strongly recommend using SwiftMailer. The development team has done tons of work to make sure any emails you send via SwiftMailer are completely standards based. This includes having a plaintext equivalent to any html email that goes out.

Re: Releative Newbie

Posted: Sat Aug 01, 2009 9:32 am
by wedmonds
Thanks I will take a look at this.

I have also been told that I should look at Pear.

What is the general view on the best program to use?

Requirements now being:

1. Ability to be send e-mail and conifigure the layout very specifically. ( I would like to add logo's, images etc and have it layed out really nicely )
2. Compatability with multiple mail systems. Idelaly the mail would check what the receipient's mail server is using before delievery the best version.
3. Security.

Thank you all for your views... they all help me! :)

wedmonds

Re: Releative Newbie

Posted: Wed Aug 05, 2009 10:04 am
by pickle
PEAR doesn't do anything useful for your code per se. It is a repository system for downloading code & classes that are useful. So there's likely a PEAR module out there for sending email, but PEAR itself won't send your email.

Re: Releative Newbie

Posted: Wed Aug 05, 2009 10:19 am
by onion2k
Also, in my experience, code in PEAR is incredibly variable in terms of quality. Some of it is brilliant but some of it is worse than useless.

If you're sending HTML email then Swiftmailer is the best option by miles. PHPMailer comes a distant second. PEAR's offerings just aren't good enough.

Re: Releative Newbie

Posted: Thu Aug 06, 2009 10:18 am
by wedmonds
Thanks guys.

Off to start a post in the swift forum now :) :banghead: