CyberCodes
PHP mail Function Welcome

Reminders sa mga rehistradong myembro:

•ang lengwahe na gagamitin ay pawang english at tagalog lamang

•Bawal po dito ang pakikipag away

•Bawal ang mga shorcut na mga words
Example: txt, Pwd, at iba pa

•Bawal mababastos at masasakit na salita o anu mang makakasakit
ng damdamin ng isang myembro ng forum na ito

•use the "like" button if the post of the following user you think are usefull



Join the forum, it's quick and easy

CyberCodes
PHP mail Function Welcome

Reminders sa mga rehistradong myembro:

•ang lengwahe na gagamitin ay pawang english at tagalog lamang

•Bawal po dito ang pakikipag away

•Bawal ang mga shorcut na mga words
Example: txt, Pwd, at iba pa

•Bawal mababastos at masasakit na salita o anu mang makakasakit
ng damdamin ng isang myembro ng forum na ito

•use the "like" button if the post of the following user you think are usefull

CyberCodes
Would you like to react to this message? Create an account in a few clicks or log in to continue.

PHP mail Function

Go down

PHP mail Function Empty PHP mail Function

Post by mitha Sat Jun 30, 2012 9:44 pm


PHP MAIL FUNCTION

E-mails in PHP can be easily sent using the library function 'mail'. This function takes four arguments to send E-mails from a PHP web page and returns 'true' upon successful delivery of Email. The parameters of this function are as follows:
Recipient E-mail address
E-mail Subject
E-mail message (body)
Headers and additional parameters like the Sender E-mail address


HTML CODE

Code:
<form name="frmsendmail" method="post" action="" onSubmit="return ValidationForm()">
<table width="100%" border="0">
<tr>
<td width="33%" align="right" class="text">To :
<td width="67%"><input name="txtEmailto2" type="text" class="input" id="txtEmailto22" size="30" maxlength="100">
</tr>
<tr>
<td align="right" class="text">From :
<td><input name="txtEmailfrm2" type="text" class="input" id="txtEmailfrm22" size="30" maxlength="100">
</tr>
<tr>
<td align="right" class="text">Subject :
<td><input name="txtSub2" type="text" class="input" id="txtSub22" size="30" maxlength="100">
</tr>
<tr>
<td align="right" class="text">Mesage(body) :
<td><textarea name="txtMsg" cols="50" rows="10" class="input" id="textarea"></textarea>
</tr>
<tr>
<td align="right"><input name="hidSubmit" type="hidden" id="hidSubmit" value="true">
<input name="Submit" type="submit" class="input" value="Send">
<td><input name="Submit2" type="reset" class="input" value="Reset">
</tr>
</table>
</form>

PHP CODE


//Check whether the submission is made
if(isset($hidSubmit)){
//Declarate the necessary variables
$mail_to=$txtEmailto;
$mail_from=$txtEmailfrm;
$mail_sub=$txtSub;
$mail_mesg=$txtMsg;
//Check for success/failure of delivery
if(mail($mail_to,$mail_sub,$mail_mesg,"From:$mail_from/r/nReply-to:$mail_from"))
echo "E-mail has been sent successfully from $mail_sub to $mail_to";
else
echo "Failed to send the E-mail from $mail_sub to $mail_to";
}
?>
mitha
mitha
Gallery Moderator
Gallery Moderator

Posts : 42
Credits : 1113
Fame : 17
Join date : 2012-06-23
Age : 30

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum