PHP Email Tutorial, Sending email from PHP
Posted on: April 14, 2006 at 12:00 AM
It is much easier to send email from PHP than from Perl. Read this tutorial if you have any doubts.

Sending mail in PHP

In this section we will learn how to send email from PHP program.

You can send email from your PHP script using mail(...) function.

Syntax:
bool mail(string to, string subject, string message, string additional_headers).
will send e-mail message with the message body containing in message feild to the receiver specified in to field.
You can assign several destination addresses in the to field by placing them in the string separated by commas or blank spaces.

Example 1.
mail("[email protected], [email protected], [email protected]",
    "Test subject",
    "Test\n message body\n\n End line");


Also you can assign values to variables and then pass them to function call.

Example 2.
$email="[email protected], [email protected]";
$subject="Test subject";
$letter="Test\n message body\n\n End line";
mail($email, $subject, $letter);

So owner of the e-mail address admin@yourdomain.com receives "Test msubject" letter. You can control Reply-To, From message fields and other special fields passing the info into additional parameters string in the last mail() function argument.

mail("[email protected]",
    "Test letter 2",
    "Test\n body 2\n\n End line",
    "From: webmaster@$SERVER_NAME\nReply-To: webmaster@$SERVER_NAME\nX-Mailer: PHP/" . phpversion());

Additional mail message fields separated by new line symbol (\n).

Example 3.
mail($email, "Subscription",
    "$letter",
    "From: [email protected]\nReply-To: [email protected]\nX-Mailer: PHP/" . phpversion());


 
More Tutorials on roseindia.net for the topic PHP Email Tutorial, Sending email from PHP.
PHP Email Tutorial, Sending email from PHP
Sending mail in PHP In this section we will learn how to send email from PHP program. You can send email from your PHP script using mail(...) function... call. Example 2. $email="[email protected], [email protected]
 
Regular expression in PHP for email - PHP
Regular expression in PHP for email  can any one tell me how to write regular expression in PHP for email to retrieve all the valid email ID's from the email
 
Sitemap PHP Tutorial
Questions | Site Map | Business Software Services India PHP Tutorial... | XML Expat Library | PHP : Form to Email | Create your Email Server... Tutorial Section Why PHP Is So Useful | Evolution of PHP for Scripting Needs
 
email search code in php
email search code in php  email search with multiple option in php
 
php
php  im beginner to php. i faced problem with creating form and data...;Email</td> <td><input type="text" name="email" size="20...(20),username char(20),pwd char(20),email char(20),PRIMARY KEY(username)); <
 
php
php  im beginner to php. i faced problem with creating form and data...;Email</td> <td><input type="text" name="email" size="20...(20),username char(20),pwd char(20),email char(20),PRIMARY KEY(username)); <
 
php
php  how to set email remainder in php?can you help me pls
 
PHP : Form to Email
PHP : Form to Email       With the help of this tutorial you can send mails to a user using a form, as we have discussed in our earlier tutorial, it is very easy to send mails using PHP and any
 
php send mail with attachment
php send mail with attachment  Syntax of sending email with attachment in PHP
 
Create your Email Server by PHP
Create your Email Server by PHP       Create your Email Server by PHP (Learn to Create your Email Server.)ADS... server and PHP can turn your computer into a server. This tutorial will help you
 
PHP MySQL on Centos 5.x
from PHP application. Hope this tutorial will help you in installing MySQL...PHP MySQL on Centos 5.x This Tutorial show you how to install MySQL support... MySQL support into your php application. In this tutorial I will show you how
 
Sending an email in JSP
Sending an email in JSP       Sending an email in JSP In this section, you will learn how to send an email in jsp.   Following is a simple JSP page for sending
 
PHP Form, PHP guest form
;); The whole PHP code from the first part of the tutorial will look like...PHP email form HTML form It's not a good idea to leave your private e...;br> </form><br> <?php //php-code from the Part 2<br>
 
Email sending
Email sending  Hi sir, Am doing a project, in that i need to send email to multiple recipients at a same time using jsp so send me the code as soon as possible. Regards, Santhosh
 
how to send email in php and attech with any file
how to send email in php and attech with any file  how to send email and attech with any file like text, image, video
 
Sending email with read and delivery requests
Sending email with read and delivery requests  Hi there, I am sending emails using JavaMail in Servlets on behalf of a customer from the website, and I'm having difficulty understanding how to implement, read and delivery
 
PHP
name, 2012 I CAN SEND THE ATTACHMENT THAT I HAVE DONE FROM PROJECT 1. THE REASON I AM SENDING YOU IS THAT I CANNOT EVEN COMPLETE THE PROJECT 1 AS REQUIRED
 
Email sending in jsp - JSP-Servlet
Email sending in jsp  Hi, Im trying to send email from my jsp... i've already tried a sample code from google, for sending email to my office 'smtp... email From To Subject Message
 
PHP Tutorials from RoseIndia
PHP : Form to Email With the help of this tutorial you can send mails...PHP Tutorials from RoseIndia The detailed PHP tutorials for beginners and experienced programmers from RoseIndia will help you learn PHP scripting
 
email
email   hi I am using 1and1 server. Using this server i am sending a mail using java program . But it is running some problem occur " Cannot send email. javax.mail.SendFailedException: Invalid Addresses;ADS_TO_REPLACE_1
 
PHP Training
Introduction to Emailing in PHP mail() function Sending email from PHP program File System Management in PHP Opening... System Management in PHP covering from Opening a File in PHP to File Locking using
 
jQuery to validate Email Address
jQuery to validate Email Address       In this  jQuery tutorial we will develop a  program that validate the email address  from server and displays on the user browser
 
sending email using smtp in java
sending email using smtp in java  Hi all, I am trying to send and email to through my company mail server. Following is my code package com.tbss... to = "[email protected]"; String from = "[email protected]"; String subject = "Testing
 
php problem
php problem  Hello!! I have a problem ,i want to display the data... not connect: ' . mysql_error()); } $sql = 'SELECT * FROM users WHERE username="'.$username...; ". "Email : {$row['email']} <br> ". "--------------------------------<
 
Sending emails and insert into trable
_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion...=$_POST['return_time']; $name = $_POST['name']; $email_from = $_POST['email...($email_exp,$email_from)) { $error_message .= 'The Email Address you entered
 
What is PHP ?
before sending along to the PHP code and converts it into HTML code.ADS... then a warning message will be generated.  Usage From PHP 4 onwards...What is PHP? PHP is an acronym stand for Hypertext PreProcessor. It is an open
 
Complete php tutorial
. Thanks   Hi, Learning PHP is now very easy from tutorials from many... Learn PHP at PHP - Hypertext Preprocessor tutorial page. Thanks...Complete php tutorial  Hi, I am trying to find the url to learn
 
PHP Introduction
for developing dynamic web pages and data execution from the databases. PHP web pages can... from its extension which is .php. As we have earlier mentioned that PHP... database, creating conditional pages, Cookies Setting, Sending Email, etc
 
Send email as html with embedded images as background
Send email as html with embedded images as background  Hi, I am developing a PHP mailing application. I have to send image in the email as attachment. Give me solution for sending image in the email data. Thanks
 
Best PHP tutorial for beginners
PHP from beginning. PHP Tutorial index page. You find good tutorials... MySQL Tutorial index page. Above tutorials will help you in learning PHP from...Best PHP tutorial for beginners  Hi Friends, I want to learn PHP
 
Sending email without authentication
Sending email without authentication  Hi sir, Am doing a project in JSP, in that i want to send mail without any authentication of password so send.../mail/sending-an-email-in-jsp.shtml
 
PHP SQL Random
; The PHP SQL Random is used to fetch data randomly from database in PHP. The Rand...; Understand with ExampleADS_TO_REPLACE_1 The Tutorial illustrate an example from... data from table randomly. <?php   $con 
 
PHP Tutorial
PHP Tutorial  Hi, I am new in PHP programming. Can anyone provide me good urls to learn PHP? Thanks   Hi, Start learning PHP at PHP Tutorial section. Thanks
 
sending automatic email - JavaMail
sending automatic email  Dear sir. In my project i need to send an automatic email to the clients when their accounts are going to expire in 30 days.i am using jsp,mysql and tomcat for my project.Expire information are stored
 
php
php  retrieve data from mysql in php   Please visit the following links: http://www.roseindia.net/sql/mysql-table/mysql-php-select.shtml http://www.roseindia.net/sql/mysql-example/select-where.shtml
 
php
php  plz tell me code for PHP SQL Insert,delete,update,view is used to insert the record from HTML page to Mysql database using in single PHP form
 
jQuery to validate Email Address Validation
jQuery to validate Email Address       In this  jQuery tutorial we will develop a  program that validate the email address  from server and displays on the user
 
sending email code - JSP-Servlet
sending email code  How To Send Emails using jsp  Hi friend, I am sending you a link. This link will help you. Please visit for more information. http://www.roseindia.net/mail/sending-an-email
 
PHP Tutorial
on roseindia.net PHP Tutorial (adsbygoogle = window.adsbygoogle || []).push...PHP Tutorial  Hi, I am looking for PHP tutorials on roseindia.net. Provide me the urls of PHP tutorials? Thanks (adsbygoogle
 
php
can learn php mysql connectivity examples from the given link: PHP Mysql Connectivity
 
PHP Tutorial
programmer. Our beginners PHP tutorial is full of examples that will help... is beginning PHP as a career will gain adequate knowledge from our PHP beginner’s...The Roseindia Technologies has offered this tutorial for the beginners who want
 
Email queue while sending mail using Struts Class
Email queue while sending mail using Struts Class  Can I maintain a queue of mails being sent from a JSP page in a DB to get its status
 
Email queue while sending mail using Struts Class
Email queue while sending mail using Struts Class  Can I maintain a queue of mails being sent from a JSP page in a DB to get its status
 
code for sending email using j2me
code for sending email using j2me  could someone tell me why when i try to compile this line using netbeans 7.1 Properties property... for sending a file attachment to gmail account
 
jQuery email validation
jQuery email validation  Hi, I am using jQuery in my PHP based web application. I have to validate the email address entered by user on the form. I also want to display the error message in red color if email address
 
PHP mail setting - Java Beginners
PHP mail setting  Hai, I want to send an email from my php program... = ""; //subject $header = "From: ". $Name . " <" . $email . ">\r\n... name $email = "[email protected]"; //senders e-mail adress
 
automatically resend when connection lost in sending email
automatically resend when connection lost in sending email  send automatically email when connection lost in sending bulk email using javamail for exp more than 10000 emails
 
automatically resend when connection lost in sending email
automatically resend when connection lost in sending email  send automatically email when connection lost in sending bulk email using javamail for exp more than 10000 emails
 
automatically resend when connection lost in sending email
automatically resend when connection lost in sending email  send automatically email when connection lost in sending bulk email using javamail for exp more than 10000 emails
 
Send Email From JSP & Servlet
J2EE Tutorial - Send Email From JSP & Servlet... As for sending mail from webserver, using JavaMail API, the following code shows how the required data such as 'from', 'to', 'subject' and 'message
 
Ads

Related Tags for PHP Email Tutorial, Sending email from PHP:


Ads

 
Advertisement null

Ads