PDA

View Full Version : [PHP] PHP mail() Function



Dentafrice1
27-05-2006, 12:15 PM
Here is something you might need later on:

A Tutorial about the Function Mail

Lets start off by making a file called: email.php

This is the format for the Mail Function:

mail($_GET[email],"SUBJECT",$msg,"From: <COMPANY>[email protected]\n");

Paste that into the email.php file.

Save it.

Now we need to edit that code.

Example my comany is HNFM and im contacting them about the DJ Panel.


mail($_GET[email],"Information About The DJ Panel",$msg,"From: <HNFM>[email protected]\n");

Edit that to the right information.

Save it.

Now Lets work on the $msg.

Here is the Message Variable:

$msg .= "YOUR MESSAGE BEFORE THE N's \n\n";

You can have many, example:


$msg .= "ATTENTION: About Your Application At HNFM\n";
$msg .= "---------------------------------\n\n";
$msg .= "Welcome! Im Kevin Your New Director At HNFM,\n\n";
$msg .= "I Need You To Respong With The Following Information for the DJ Panel.\n\n";
$msg .= "Username:\n";
$msg .= "Password:\n\n";
$msg .= "Please Reply To The Following Email: .";
$msg .= "Again I Thank You For Applying and I hope for a reply soon,\n\n";
$msg .= "Kevin\n\n";
$msg .= "-------------------------------\n\n";
$msg .= "HNFM Owner / Director Of Applications\n\n";

Many more or many less it dont matter http://www.habboentertainment.com/forum/images/smilies/biggrin.gif

Now for selecting the email to send it to.

go to: http://www.yoursite.com/[email protected]

Or for more advanced people making user systems or DJ Panels Just:



http://www.yoursite.com/email.php?email=<? echo $email; ?>

Define email as like


$query = mysql_query("SELECT * FROM user WHERE username='$username'");
$row = mysql_fetch_array($query) or die(mysql_error());

And do:

$email = $row[email];

Thats about it for now.

BTW: This was my first tutorial

Thanks,
Kevin
(Dentafrice)

Want to hide these adverts? Register an account for free!