PHP mail with HTML

the mail() function

Moderators: egami, macek, gesf

Post Reply
johnj
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Tue Apr 12, 2011 8:44 am

Yes this is possible provided you can recreate the whole thing in html. How to send the html by email - please read egami's reply on a similar topic here,
viewtopic.php?f=17&t=12178

johnj
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Thu Apr 14, 2011 2:00 am

Assuming that the table showed in the image is <table><tr><td>Product</td>......</table>". Move this to a php variable.e.g. $myMessage = "<table><tr><td>Field1</td>......</table>"; Then, continue with sending the email..use $myMessage as the message to be sent.

johnj
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Fri Apr 15, 2011 6:17 am

You need to establish a connection with the database, select a database etc...please take a look at this page
http://www.php.net/manual/en/function.m ... ect-db.php

johnj
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Sat Apr 16, 2011 6:16 am

a). First, print all these ($to, $subject, $message, $headers) to see if all these has appropriate required values.

b). Then, to to your error log to see what error message does php post

c). You need to code your functions with appropriate error validation: for e.g. mail() should be mail() or die("error")...or something similar...

d). Check your php.ini for the name of the smtp server, port, from email address etc

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest