wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
class.Mail.php
Go to the documentation of this file.
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2014 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of any of the following licenses
7  * at your choice:
8  *
9  * - GNU Lesser General Public License (LGPL)
10  * http://www.gnu.org/licenses/lgpl.html
11  * - Eclipse Public License (EPL)
12  * http://www.eclipse.org/org/documents/epl-v10.php
13  *
14  * See the license.txt file distributed with this work for
15  * additional information.
16  *
17  * $Id: class.Mail.php 1462 2014-02-04 23:52:27Z iherwig $
18  */
19 require_once(BASE."wcmf/lib/util/class.Message.php");
20 /**
21  * @class Mail
22  * @brief Class to send mails.
23  *
24  * @author ingo herwig <ingo@wemove.com>
25  */
26 class Mail
27 {
28  /**
29  * Send an email.
30  * @param fromName The senders name
31  * @param fromEmail The senders email adress
32  * @param toEmail The recipients email adress
33  * @param subject The subject of the email
34  * @param body The body of the email
35  * @return True/False wether the mail was successfully sent.
36  */
37  function send($fromName, $fromEmail, $toEmail, $subject, $body)
38  {
39  // replace ":", ";", "," in $fromName for use in "From" and "Reply-To"
40  $email_header = str_replace(array(':', ';', ','), ' ', $fromName);
41 
42  $headers = "";
43  $headers .= "From: ".$email_header."<".$fromEmail.">\n";
44  $headers .= "X-Sender: <".$email_header.">\n";
45  $headers .= "X-Mailer: PHP\n";
46  $headers .= "X-Priority: 3\n";
47  $headers .= "Reply-To: ".$email_header."<".$fromEmail.">\n";
48  $headers .= "Content-type: text/plain; charset=iso-8859-1\n";
49 
50  return mail($toEmail, $subject, $body, $headers);
51  }
52 }
53 ?>
send($fromName, $fromEmail, $toEmail, $subject, $body)
Definition: class.Mail.php:37
Class to send mails.
Definition: class.Mail.php:26