Sending an email through mail( ) function
Posted: Mon Mar 02, 2009 6:19 am
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.";
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.";