Sending Mail
Tequila don't recommend you to rely on PHP mailing options as they have some limitations, Tequila uses the powerful PHPmailer library and the really good freakmailer script (from phpfreaks) plus the information on the configuration file to make sending email really easy.
What you need:
PHPmailer package *included
Modify config.php to use a valid account or mode
Code to send email
If you don't feel like adding the 5 required lines you can just copy this mail into the class that sends email or in includes/functions.php
We might add this function later in common functions:
Email function sample:
function send($email_to, $subject, $message, $isHTML = false){ $mail = new freakmailer(); if (is_array($email_to))
{ foreach($email_to as $email) { $mail->AddAddress($email, $email); } } else { $mail->AddAddress($email_to, $email_to); } $mail->IsHTML($isHTML); $mail->Subject = $subject; $mail->Body = $message; return $mail->Send();}
Sending email using gmail
Gmail use a SSL/TLS protocol for forwarding SMTP email, this is/was not supported by the phpmailer class.
We found this fix to make it work, if you have any problems please visit the original page (spanish):
This fix is added in final release version 3.0 If you have a previous library modify the code as follows:
File: class.phpmailer.php
Line: 537
Find and comment:
#-- Original Codeif(strstr($hosts[$index], ":")) list($host, $port) = explode(":", $hosts[$index]);else{ $host = $hosts[$index]; $port = $this->Port;}
Paste this code instead (right after the previous one)
#-- This code for sending mail with gmailif (preg_match('#(([a-z]+://)?[^:]+):(\d+)#i', $hosts[$index], $match)){ $host = $match[1]; $port = $match[3];}else{ $host = $hosts[$index]; $port = $this->Port;}
* Notice: You must enable OpenSSL extension in PHP to make this work
Another possible solution if you don't want to enable OpenSSL is to modify (We haven't tested this!):
File: class.smtp.php
Line 1024:
Original: while($str = fgets($this->smtp_conn,515)) {
Change to: while($str = @fgets($this->smtp_conn,515)) {
If you don't know how to install and enable extensions, try this link