WHAT TO DO: email not sent

Talk and info about common issues

Moderator: alexandrleonenko

administrator
Site Admin
Site Admin
Posts: 6011
Joined: Jan 7th, '09, 23:18
Contact:

WHAT TO DO: email not sent

Postby administrator » Feb 9th, '11, 17:09

FOR NEW VERSIONS (3.8.0 OR LATER)
Now you have 2 options to send email.
1. Send emails, using the embedded PHP mail() function (see description for OLD VERSIONS at the bottom)
email1.png
email1.png (17.47 KiB) Viewed 2717 times


2. Send emails, using SMTP server.
email2.png
email2.png (20.17 KiB) Viewed 2718 times

- If you have troubles with sending emails, using SMTP server, go to admin/handlers/handler_settings.php, find there $mail->SMTPDebug = 0; and define it as $mail->SMTPDebug = 1; then debug procedure of sending emails.


- For some cases you could only work after changes in the: \modules\phpmailer\class.phpmailer.php
Find $SMTPOptions and change it:
public $SMTPOptions = array();
to
public $SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) );


FOR OLD VERSIONS (< 3.8.0)
To make site send emails as expected you must perform following steps:

1. Open General -> Settings and enter valid email address, based on domain of your site.
If for example your domain is www.my_best_site.com, so you email may be something like admin@my_best_site.com

email_send.png
email_send.png (39.85 KiB) Viewed 3263 times


2. If this doesn't help, try to create a simple php file with following code:

Code: Select all

<?php
$mail_to = ".... write here destination email... ";
$mail_from = "admin@my_best_site.com";

$headers = 'From: '.$mail_from."\r\n".
           'Reply-To: '.$mail_from."\r\n".
           'X-Mailer: PHP/'.phpversion();
return @mail($mail_to, "Subject - test", "Test test test", $headers);
?>


and try to run from root directory of your site.

3. Your server may require a specific parameters for mail() function, so if the test file doesn't send emails - please ask your hosting provider to help in solving this problem. After you have a working example of code - you may implement it in include/classes/Email.class.php

4. If email is sendig as a plain text, try following solution:
Change this line of Email.class.php

Code: Select all

define("EC_NEWLINE", "\r\n"); /* newline character(s) */

to

Code: Select all

define("EC_NEWLINE", "\n"); /* newline character(s) */

Return to “ApPHP MicroCMS {HOW TO}”