Larryzx
10-15-2009, 05:00 PM
I am new to php, firstly what does php mean, secondly and more seriously I would like to know how to send a attachment as part of a mail using the mail function..
I copied the following code off the net it works but I dont know how to make it work to send an attachment to.
<?php
//define the receiver of the email
$to ="lawwz@hotmail.com";
// define the subject
$subject = "Testing mail function";
// define the message to be send each line should be separated with a \n
$message ="Hello there how are you\nfine thanks ";
//define the headers we want passed. Note they are separated with \r\n
$headers ="From: lawwz@hotmail.com\n";
$headers .="Reply-To: lawwz@hotmail.com";
//send the mail
$mail_sent = @mail[/B]($to, $subject, $message, $headers);
echo $mail_sent ? "Mail sent" : "Mail failed";
?>
Also I get a waring with this code but if I change the last line to @mail instead of mail(...) it doesnt give the warning?
I copied the following code off the net it works but I dont know how to make it work to send an attachment to.
<?php
//define the receiver of the email
$to ="lawwz@hotmail.com";
// define the subject
$subject = "Testing mail function";
// define the message to be send each line should be separated with a \n
$message ="Hello there how are you\nfine thanks ";
//define the headers we want passed. Note they are separated with \r\n
$headers ="From: lawwz@hotmail.com\n";
$headers .="Reply-To: lawwz@hotmail.com";
//send the mail
$mail_sent = @mail[/B]($to, $subject, $message, $headers);
echo $mail_sent ? "Mail sent" : "Mail failed";
?>
Also I get a waring with this code but if I change the last line to @mail instead of mail(...) it doesnt give the warning?