anvc / scalar

Born-digital, open source, media-rich scholarly publishing that’s as easy as blogging.
Other
232 stars 73 forks source link

Error with sending email #168

Open Grantglass opened 3 years ago

Grantglass commented 3 years ago

system/application/libraries/SendMail.php:109

Looking at that file, it actually looks like there is a discrepancy between the instructions in the config file and the sendmail code.

That function starts with: private function send($arr=array()) {

    $mail = new PHPMailer;

    $smtp_host = $this->CI->config->item('smtp_host');
    if (!empty($smtp_host)) {

Note that it’s instantiating a new PHPMailer object, and that’s what is being defined. That object also is pulling the $smtp_host from the config section, which is defined by the environment variable SCALAR_SMTP_HOST - This makes it look like the config instructions and the code are not in alignment.

craigdietrich commented 3 years ago

Hi @Grantglass,

Thanks for reaching out! I admit that I'm not sure what problem you're describing? Could you elaborate?

Grantglass commented 3 years ago

I am having trouble sending emails, my server uses php mail and I’ve tried to configure scalar and it to send emails but it fails. How should I configure the scalar environment variables so I can use the php mail service and not it?

On Sun, May 30, 2021 at 3:25 PM Craig Dietrich @.***> wrote:

Hi @Grantglass https://github.com/Grantglass,

Thanks for reaching out! I admit that I'm not sure what problem you're describing? Could you elaborate?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/anvc/scalar/issues/168#issuecomment-851048628, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABH7URZBZAU4Z7HJBQ63H2DTQKGKHANCNFSM45PWP4IA .

craigdietrich commented 3 years ago

Right, so, the way we implemented the email system is using SMTP, and 'new PHPMailer' is an SMTP helper class unrelated to PHP's mail() function. You'd need to have SMTP active on your server and an account (e.g., a Gmail account or an institutional account) to point the SMTP fields towards.

There is no support for mail(), though that doesn't mean we can't add it, say with a field in local_settings.php that lets you choose SMTP vs mail(). I can add this to our list, but it might take a little while.