Skip Navigation LinksHome > Categories > Code from a Category

Sending emails using php. Cookbook



User Name: serfcompany
Name: Serf
Contact Me: www.datawebcoder.com
Home Page: www.datawebcoder.com
php,mysql,javascript,html,css. Preferable working with Zend Framework. Good know javascript. I worked with various, javascript frameworks such as(jquery, YUI3, extjs, sencha touch). [More]
Viewed Times: 2023
Add Date: 02/19/2012
In this paper we consider the sending of emails in PHP. Sending emails in php by using mail () function

Sending plain text emails


This is the easiest way to send messages. You just enter the email recipient, sender, and format text / plain in the title. Following is an example



Sending html-mail in which you can insert tables, pictures, different fonts, styles


Sending emails in html format is almost no different from sending emails in plain text. In the title you specify the format of the message text / html and in the letter, instead of plain text put a html-code.


Consider the example



Sending a letter with an attachment


To attach a file to take a little longer code, but it is also quite simple. In the following code, list the name of your file that you want to send as well as its location



Sending messages to multiple recipients


To send a message to multiple recipients, it is best to use the title Bcc: copy of a letter that sends an email to the specified


For example

Post a Comment

Name: (Optional)
Email: (Optional, you can get an email if somebody replys your comments)*
Email me if somebody respons my comment below:
Details**:
Enter Text
as Below:
(case insensitive, if hard to read, click the "get a new one" button)
 
    
* Your email address will not be shared with any third parties for any reason.
** Maximum 1000 charactors.