I so far know that with submit form, I can send text in <textarea> to an email.
I wonder that now can we send a page with table in it to email by using submit form?
If it can be done, pls let me know what method to do, or a simple example is very appreciated.
Thanks for any guide.
Your link doesn't seem to be working, abduraooft. I think it's a problem with php.net because the main site and other pages of that site are still working...
docco, you just need to retrieve what the user has entered, save it into a variable, then concatenate that variable to your email body (if you want to send anything more than just the text).
$email = "your_email@domain.com";//for example
$to = $email;
$subject = "User Comments";
$body = "Another message has been sent to you"."<br />\n";
$body .= "The message is as follows:"."<br />\n";
$body .= $text;
// subject $subject = 'Birthday Reminders for August';
// message $message = ' <html> <head> <title>Birthday Reminders for August</title> </head> <body> <p>Here are the birthdays upcoming in August!</p> <table> <tr> <th>Person</th><th>Day</th><th>Month</th><th>Year</th> </tr> <tr> <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> </tr> <tr> <td>Sally</td><td>17th</td><td>August</td><td>1973</td> </tr> </table> </body> </html> ';
// To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
I think Example #4 Sending HTML email work w/o error because in this case it is the same with sending pure text that almost email senders such as formmail can do.
I only think and do not test because this is not what I aim at. Moreover, thing I can not know that how user can copy html text to the message area.
What I want is user can collect some items (such as shopping items). These items are shown dynamically in a table on a normal the submit form. The table will be sent along with the normal text.
I try to study Perl Mail Mime but it seems very little document to guide about this.
It is very appreciated if you can let me know what is the best formmail now?
What I want is user can collect some items (such as shopping items). These items are shown dynamically in a table on a normal the submit form. The table will be sent along with the normal text.
In that example, the html markup is hard coded where as in your case you'd need to dynamically generate the html markup and append to the body of the email. This process won't have much difference even if you use Pear package.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
In that example, the html markup is hard coded where as in your case you'd need to dynamically generate the html markup and append to the body of the email. This process won't have much difference even if you use Pear package.
Believe on you, I have checked your proposed code and the result make me astonished! There are a lot of thing I haven't know!!!
Can you advise how and by what way, the user can insert html file into submit form to send it
docco, you just need to retrieve what the user has entered, save it into a variable, then concatenate that variable to your email body (if you want to send anything more than just the text).
You can also send additional header information along with the email. That is just a simple example for you.
Thanks LC, you advice make me think much about this. But is a newbie, maybe there are something I do not know. Php is fixed in server side, and user only send email to server via submit form. And with submit form how can user add a table?
You want to send the message to a database and then display the results to the html page?
LC.
Can you expalin me know $text = $_POST['name_of_input_element_in_html_form'];
So far, I build a submitform.htm, users access it, fill in their message here (only text in the textarea). After they submit, the form will be sent to my server.
In my server, I upload a formmail.php to receive the form, process it and send the message from users to my email.
What I want to do now is that the user can have a table in the submitform.htm and the formmail.php can process and send this table to my email.