Send a mail using a PHP code??
Posted by Ib / Vce(sat) on November 3, 2006
Well i was jus working on a bit of php for my site and i liked the code part of it. Just not to forget i thought i’l put those esential chunk of code here so that i can always get them back whenever i want.
well you call it tutorial or anything this is just a code to send a mail to any mailbox form your personalised form like this one on the site that i’m developing.
Well it is always better to start with an example. Click here to see one
Well to simplify all the from address,to address,message let me just give u the single line code in php to send a mail. it goes this way as below
<?php
mail(“yourmail@yourmail.com”, “subject”, “this is the actual mesasge that’s sent”,”header”);
?>
The above code will send a mail to the given address but will send the address of sender as “anonymous@xxx.yyy.com” the following code below will asign those values to make it look as if it came from a particular email id.
<?php
$email=”madankumar.t@gmail.com”; (to address)
$message2 .= “
This is the actual message that’l be sent
“;
$headers2 .= “From: madan@invobot.com\n”;(from address to be displayed ***)
$sub2.=”This will be the subject”;
?>
<?php
mail($email, $sub2, $message2, $headers2);
?>
When you copy the above as such the quotes donot come properly!! u must manually replace all properly , better download from the link below!!
You find it difficult to copy paste and test? well download it hereWell now the fun part. Is your college principals email id something like “xxxx@college.com“??? and your class teachers’s E-mail something like “yyyy@college.com“??? heya, why not send a mail to your proff from the principal? don mind uh.
cheers
Madan
Note: Any suggestions here is just an idea for fun. no legal issues can be brought upon me for anything that is suggested in this site. Thankyou
emboxy said
ford dealer in houston