I'm looking for information on creating complex email using PHP. My site currently uses the mail() function to send email but I want to send complex email using HTML for formating/images and PHP/MySQL to personalize the message. The PHP Manual talks about complex email but the doco is brief. Any info, links to tutorials, etc would be appreciated.
For sending MIME message (with attachments), use the MIME Mail class for PHP:
And to customize the content, it's like generating dynamic HTML pages and send it using MIME Mail class.
I've have downloaded the HTML Mime Mail Class from Richard Heyes. I put example.php in a php page on my site but I don't get the email. Below is the code I included in the page. I'm using PHP4, MySQL and Apache for win32. php.ini is configured for includes and mail. My SMTP mail server is mail.idirect.ca and I use http://127.0.0.1/ to serve my pages on my local machine. My site is in development and not hosted. Can anyone tell me what I'm doing wrong? Also, how do I set things up for hotmail as hotmail uses a HTTP server, not SMTP?
$filename = 'images/background.gif';
$backgrnd = fread($fp = fopen($filename, 'rb'),filesize
$mail = new html_mime_mail('X-Mailer: Html Mime Mail Class');
$text = 'Success.';
$html = '<HTML><BODY BACKGROUND="images/background.gif">'."\r\n".'<FONT FACE="Verdana, Arial" COLOR="#FF0000">'."\r\n".' Success...</FONT>'."\r\n".'<P></BODY></HTML>';
($backgrnd, 'images/background.gif', 'image/gif');
$smtp = new smtp_class;
$smtp->host_name= 'mail.idirect.ca'; $smtp->localhost= '127.0.0.1'; $from = 'email@example.com';
$to = array('$emailarray[index]'); $headers = array('To: $namearray[$index] <$emailarray[$index]>');
$mail->smtp_send('smtp', $from, $to, 'Welcome', $headers);
Since this post is loosing priority, I'm resending the post with hopes to get a reply. Sorry if this irritates anyone.