Hello.
I’ve been trying to send and receive e-mail but nothing!
I made your tutorial and nothing
I’m trying to set up my terra mail to work
My smtp server = smtp.sao.terra.com.br
My e-mail =
[email protected]
And o course my user name
[email protected]
My configure.php file (in admin and catalog folder) ends this way (server requires authentication):
define('SMTP_MAIL_SERVER', 'smtp.sao.terra.com.br');
define('SMTP_PORT_NUMBER', '25');
define('SMTP_SENDMAIL_FROM', '
[email protected]');
define('SMTP_FROMEMAIL_NAME', 'Forte Real');
define('SMTP_USERNAME', '
[email protected]');
define('SMTP_PASSWORD', '******');
?>
Aplication_top.php ==============================================
// include currencies class and create an instance
require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();
// include the mail classes
/* Nay -- PHPMailer
require(DIR_WS_CLASSES . 'mime.php');
require(DIR_WS_CLASSES . 'email.php');
*/
require(DIR_WS_CLASSES . 'class.phpmailer.php');
/* End Nay */
// set the language
if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
if (!tep_session_is_registered('language')) {
tep_session_register('language');
tep_session_register('languages_id');
}
Admin aplication_top.php ==================================
// entry/item info classes
require(DIR_WS_CLASSES . 'object_info.php');
// email classes
/* Nay -- PHPMailer
require(DIR_WS_CLASSES . 'mime.php');
require(DIR_WS_CLASSES . 'email.php');
*/
require(DIR_WS_CLASSES . 'class.phpmailer.php');
/* End Nay */
// file uploading class
require(DIR_WS_CLASSES . 'upload.php');
admin general.php =========================================
} else {
$value .= '.';
for ($i=0; $i<$padding; $i++) {
$value .= '0';
}
}
}
return $value;
}
/*
Old Function:
function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
if (SEND_EMAILS != 'true') return false;
// Instantiate a new mail object
$message = new email(array('X-Mailer: osCommerce'));
// Build the text version
$text = strip_tags($email_text);
if (EMAIL_USE_HTML == 'true') {
$message->add_html($email_text, $text);
} else {
$message->add_text($text);
}
// Send message
$message->build_message();
$message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
}
//Email using PHP Mailer
//Edited by Nay
*/
function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
if (SEND_EMAILS != 'true') return false;
// Instantiate a new mail object
$message = new PHPMailer();
if (EMAIL_TRANSPORT == 'smtp'){
$message->IsSMTP(); // telling the class to use SMTP
$message->SMTPAuth = true;
$message->Username = SMTP_USERNAME;
$message->Password = SMTP_PASSWORD;
}else{
//////(EMAIL_TRANSPORT == 'sendmail')
//////You need to implement here if you are using sendmail
}
// Config
$message->Host = SMTP_MAIL_SERVER; // SMTP server
if( !tep_not_null($from_email_address) ) {
$from_email_address = SMTP_SENDMAIL_FROM;
}
$message->From = $from_email_address;
if( !tep_not_null($from_email_name) ) {
$from_email_name = SMTP_FROMEMAIL_NAME;
}
$message->FromName = $from_email_name;
if( !tep_not_null($to_name) ) {
$to_name = '';
}
if( !tep_not_null($to_email_address) ) {
return false;
}
$message->AddAddress($to_email_address, $to_name);
$message->Subject = $email_subject;
// Build the text version
$text = strip_tags($email_text);
if (EMAIL_USE_HTML == 'true') {
$message->Body = tep_convert_linefeeds(array("\r\n", "\n", "\r"), '<br>', $email_text);
$message->AltBody = $text;
$message->IsHTML(true);
} else {
$message->Body = $text;
$message->IsHTML(false);
}
// Send message
if(!$message->Send()){
/*echo 'Email was not sent.';
echo 'Mailer error: ' . $message->ErrorInfo;*/
return false;
}
}
function tep_get_tax_class_title($tax_class_id) {
general.php ====================================================
// $email_subject The subject of the eMail
// $email_text The text of the eMail, may contain HTML entities
// $from_email_name The name of the sender, e.g. Shop Administration
// $from_email_adress The eMail address of the sender,
// e.g.
[email protected]
/*
Old Function:
function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
if (SEND_EMAILS != 'true') return false;
// Instantiate a new mail object
$message = new email(array('X-Mailer: osCommerce'));
// Build the text version
$text = strip_tags($email_text);
if (EMAIL_USE_HTML == 'true') {
$message->add_html($email_text, $text);
} else {
$message->add_text($text);
}
// Send message
$message->build_message();
$message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
}
//Email using PHP Mailer
//Edited by Nay
*/
function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
if (SEND_EMAILS != 'true') return false;
// Instantiate a new mail object
$message = new PHPMailer();
if (EMAIL_TRANSPORT == 'smtp'){
$message->IsSMTP(); // telling the class to use SMTP
$message->SMTPAuth = true;
$message->Username = SMTP_USERNAME;
$message->Password = SMTP_PASSWORD;
}else{
//////(EMAIL_TRANSPORT == 'sendmail')
//////You need to implement here if you are using sendmail
}
// Config
$message->Host = SMTP_MAIL_SERVER; // SMTP server
if( !tep_not_null($from_email_address) ) {
$from_email_address = SMTP_SENDMAIL_FROM;
}
$message->From = $from_email_address;
if( !tep_not_null($from_email_name) ) {
$from_email_name = SMTP_FROMEMAIL_NAME;
}
$message->FromName = $from_email_name;
if( !tep_not_null($to_name) ) {
$to_name = '';
}
if( !tep_not_null($to_email_address) ) {
return false;
}
$message->AddAddress($to_email_address, $to_name);
$message->Subject = $email_subject;
// Build the text version
$text = strip_tags($email_text);
if (EMAIL_USE_HTML == 'true') {
$message->Body = tep_convert_linefeeds(array("\r\n", "\n", "\r"), '<br>', $email_text);
$message->AltBody = $text;
$message->IsHTML(true);
} else {
$message->Body = $text;
$message->IsHTML(false);
}
// Send message
if(!$message->Send()){
/*echo 'Email was not sent.';
echo 'Mailer error: ' . $message->ErrorInfo;*/
return false;
}
}
////
// Check if product has attributes
function tep_has_product_attributes($products_id) {
admin mail.php ======================================================
$message = tep_db_prepare_input($HTTP_POST_VARS['message']);
/*
Nay -- Edited
-- Email Using PHP Mailer
Old Code:
//Let's build a message object using the email class
$mimemessage = new email(array('X-Mailer: osCommerce'));
// add the message to the object
$mimemessage->add_text($message);
$mimemessage->build_message();
while ($mail = tep_db_fetch_array($mail_query)) {
$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject);
}
*/
while ($mail = tep_db_fetch_array($mail_query)) {
tep_mail($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], $subject, $message, STORE_OWNER, $from);
}
/* End Nay */
tep_redirect(tep_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));
}
I have uploaded the two files class.phpmailer and class.smtp to both classes folders
My admin panel e-mail options:
E-Mail Transport Method = smtp
E-Mail Linefeeds = CRLF
Use MIME HTML When Sending Emails = TRUE
Verify E-Mail Addresses Through DNS = FALSE
Send E-Mails = TRUE
My store options:
E-mail address
[email protected]
E-mail from
[email protected]
Send Extra Order Emails To “nothing here”
What is wrong?? Any idea???
Thanks a lot!!!!