Email: Difference between revisions

No edit summary
adds mail test script
Line 36: Line 36:


=== My wiki won't send email ===
=== My wiki won't send email ===
First, did you check if mail is working from PHP?
<source lang="php">
<?php
    $mailto = 'greg@eQuality-Tech.com';
    $subject = 'test mail';
    $message = 'sample message';
    $from = 'wiki@example.org';
    $header = "From:$from";
    if ( mail ( $mailto, $subject, $message, $header ) ) {
        echo "Email sent\n";
        echo "Try 'sudo tail /var/log/mail.log' to look for other possible errors.\n";
    }
</source>
If your application already has email capability, but it won't send, then turn on the mail_log feature in php.ini and check that sendmail/postfix is installed on your system.  You might start with <code>sudo apt-get install mailutils</code>.  If on AWS or datacenter, you can set up as an internet site and be done.  If you are behind a consumer broadband IP, you will probably need to setup a 'smarthosted' site and use (your own) IMAP credentials to send email through another provider.
If your application already has email capability, but it won't send, then turn on the mail_log feature in php.ini and check that sendmail/postfix is installed on your system.  You might start with <code>sudo apt-get install mailutils</code>.  If on AWS or datacenter, you can set up as an internet site and be done.  If you are behind a consumer broadband IP, you will probably need to setup a 'smarthosted' site and use (your own) IMAP credentials to send email through another provider.