Popular Articles | Latest Articles | Categories | RSS Feeds

PHP mail() function

Published on 11/27/2008 by Dotnetindex
More articles in PHP



 Vote this tutorial:

 Following example uses PHP builtin function mail(). Function gets three parameter. Target email, subject and message. Default type is text. But you can enter custom headers: From, Cc, and Bcc. Multiple extra headers should be separated with a CRLF (\r\n). 

Mail function returns a boolean value.

 

 Syntax:

bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

<?php
// email address
$email "info@dotnetindex.com";

// The email subject
$subject "Enter your subject here";
// The message body (TEXT)
$message "Enter your message here";
mail($email$subject$message"From: $email");
echo "The email has been sent.";
?>

 With additional headers:
<?php
$to      
'someone@gazatem.com';
$subject 'the subject';
$message 'hello';
$headers 'From: webmaster@dotnetindex.com' "\r\n" .
    
'Reply-To: webmaster@
dotnetindex.com' "\r\n" .
    
'X-Mailer: PHP/' phpversion();

mail($to$subject$message$headers);
?>
You can get more information at this page.
 
 
 
 

Comments:
no comments submitted


Only members can write comments.Please, login / register to write comment.

Latest Posts

Active News Manager - news management system




Welcome to Dotnetindex.com:Login  |  Register
Free software:
Giga RSS Reader
IkonAdman
QMailing list
Active News
Download Manager (PRO)
Download Manager (Lite)

Search Dotnetindex.com:


Who's online

  • There 122 online users.

Latest tutorialsIntroduction to Dependency Injection Using StructureMap
SEO For ASP.NET Web Site
Using ASP.NET 3.5's ListView and DataPager Controls: The Ultimate DataPager Interface
Using jQuery To Hijack ASP.NET MVC Form Posts
Accessing and Updating Data in ASP.NET: Filtering Data Using a CheckBoxList
Predictive Fetch with jQuery and the ASP.NET Ajax Library
Building ASP.NET Web Forms to Use a MySQL Database
A Guide to Upgrading Your XP Machine for Optimum Performance with Windows 7
Retrieving Data from Microsoft SQL Server 2008 Using ASP.NET 3.5
Creating an ASP.NET Dynamic Web Page Using MS SQL Server 2008 Database (GridView Display)
Inserting Data into a Microsoft SQL 2008 Database in ASP.NET 3.5
Using C#, ASP.NET, and ADO.NET To Develop A Multi-Tier App From Start To Finish
URL Routing in ASP.NET 4.0
Integrating Twitter Into An ASP.NET Website
Creating Multiple Choice Exam Application Using ASP.NET MVC Framework
ASP.NET Resources, Reviews

ASP Resources, Reviews

PHP, ASP, .NET, JSP Resources, Reviews

Hotscripts.com Free Photoshop, Flash and 3DS MAX tutorials