Send a mail using a PHP code??

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 🙂

Advertisements

One thought on “Send a mail using a PHP code??

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s