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 [email protected]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: [email protected]$SERVER_NAME\nReply-To: [email protected]$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
 
email search code in php
email search code in php  email search with multiple option in php
 
Sitemap PHP Tutorial
Questions | Site Map | Business Software Services India PHP Tutorial... | XML Expat Library | PHP : Form to Email | Create your Email Server by PHP  | PHP Ajax | PHP SimpleXML | PHP Ajax DB PHP Tutorial Section
 
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 : 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
 
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
 
Create your Email Server by PHP
Create your Email Server by PHP       Create your Email Server by PHP (Learn to Create your Email Server.) Create your Email Server Whenever we develop an email system, we can not test
 
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
 
php
php  how to set email remainder in php?can you help me pls
 
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
 
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
 
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; nested exception
 
php send mail with attachment
php send mail with attachment  Syntax of sending email with attachment in PHP
 
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 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
 
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
 
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
 
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>
 
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
 
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 Tutorials from RoseIndia
PHP Tutorials from RoseIndia The detailed PHP tutorials for beginners and experienced programmers from RoseIndia will help you learn PHP scripting... in PHP. Top Tutorials of PHP PHP Tutorial Starting PHP PHP MySQL Zend
 
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
 
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
 
PHP Training
Introduction to Emailing in PHP mail() function Sending email from PHP..., with a particular study of MySQL Here is the video tutorial of "PHP... from Opening a File in PHP to File Locking using flock() function in PHP. We
 
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
 
jQuery to validate Email Address Validation
; program that validate the email address  from server and displays on the user... to develop the  program for Email Address Validation Step 1: Create php...jQuery to validate Email Address   
 
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> ". "--------------------------------<
 
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
 
Best PHP tutorial for beginners
  Hello, Browser following urls to learn PHP from beginning. PHP Tutorial index page. You find good tutorials for learning php from beginning...Best PHP tutorial for beginners  Hi Friends, I want to learn PHP
 
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
 
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
 
What is PHP ?
before sending along to the PHP code and converts it into HTML code. Brief... will be generated.  Usage From PHP 4 onwards, the PHP parser compiles input...What is PHP? PHP is an acronym stand for Hypertext PreProcessor. It is an open
 
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
 
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
 
PHP SQL Random
; Understand with Example The Tutorial illustrate an example from PHP SQL Random... PHP SQL Random       The PHP SQL Random is used to fetch data randomly from database in PHP. The Rand
 
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 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
 
PHP Tutorial
PHP Tutorial  Hi, I am looking for PHP tutorials on roseindia.net. Provide me the urls of PHP tutorials? Thanks   Hi, Here is the links on roseindia.net PHP Tutorial Complete PHP Tutorials Many Free PHP Tutorials
 
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
 
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
 
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
 
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
 
regarding email - Development process
this by calling the Send mail servlet. For sending email please visit the following link...regarding email  Hi I want to generate an Email automatically after... if needed it will append the values from databse and it shus be sent to that person
 
email problem - JavaMail
email problem  hi,i want to write a code for sending a mail to a company employees having strength more than 1000.I had fetched the mail ids from... should have the email id of only 1 employee only(means he will not able to know who
 
Ads

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


Ads

 
Advertisement null

Ads