A html and a text file was generated and . When I tried to put $order_file in $message, it gave me error. How can I put the content of a text file in $message and email it?
This is the code I tested and it worked:
<?php
$order_file = $_POST["orderfile"];
$to = "someone@test.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message./n";
$from = "Elegant Essen Catering";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
Sending an email through mail( ) function
Moderator: General Moderators
- becky-atlanta
- Forum Commoner
- Posts: 74
- Joined: Thu Feb 26, 2009 6:26 pm
- Location: Atlanta, GA
Re: Sending an email through mail( ) function
function file_get_contents
the order file must exist and correctly placed. you would need to process the $_POST to ensure this is so.
Code: Select all
<?php
$order_file = $_POST["orderfile"];
$message = file_get_contents($order_file);
- becky-atlanta
- Forum Commoner
- Posts: 74
- Joined: Thu Feb 26, 2009 6:26 pm
- Location: Atlanta, GA
Re: Sending an email through mail( ) function
php_east,
Thanks for the tips. I processed the order form to a unique html file. When the customer click "Confirm Order", the next process was to send the order in html format to the company. It works like magic!!
THANK YOU!
Thanks for the tips. I processed the order form to a unique html file. When the customer click "Confirm Order", the next process was to send the order in html format to the company. It works like magic!!
THANK YOU!