It's for ADM <= v2.1.
At first you have to install from App Center the Optware ipkg.
After, enter the shell with root user and give the command:
Code: Select all
ipkg install msmtp
Create or edit the msmtp configuration file in the user’s home directory.
Remember that every user needs to send email must have it's own .msmtprc
Use vi editor:
Code: Select all
vi ~/.msmtprc
Code: Select all
account yahoo
tls on
tls_starttls off
auth on
host smtp.mail.yahoo.com
user user
from user@yahoo.com
password ******
tls_trust_file /etc/ssl/certs/ca-certificates.crt
account gmail
tls on
auth on
host smtp.gmail.com
port 587
user user@gmail.com
from user@gmail.com
password ******
tls_trust_file /etc/ssl/certs/ca-certificates.crt
If you're going to use a not listed provider, you've to find the authority certificate and add into the file /etc/ssl/certs/ca-certificates.crt
or another file to specify into the option tls_trust_file.
To protect passwords give read access only to the owner:
Code: Select all
chmod 600 ~/.msmtprc
Code: Select all
vi test_email
Code: Select all
From: Bob <bob@example.com>
To: Jane <jane@domain.com>
Subject: Hello Jane
Test email sent with msmtp
Code: Select all
cat test_email | msmtp -a yahoo jane@domain.com
Now let's configure for use with PHP Mail() function.
Use vi to create the file:
Code: Select all
vi /volume0/usr/builtin/etc/php5/apache2/msmtprc
Protect with right access:
Code: Select all
chmod 600 msmtprc
find with:
Code: Select all
ps -ef | grep apache2
9916 root 0:00 /usr/builtin/sbin/apache2 -k start
9918 admin 0:00 /usr/builtin/sbin/apache2 -k start
Code: Select all
chown admin msmtprc
Code: Select all
vi /volume0/usr/builtin/etc/php5/apache2/php.ini
Code: Select all
sendmail_path = "/usr/bin/msmtp -C /etc/msmtprc -a yahoo -t"
Code: Select all
<?php
mail("jane@domain.com","Hello World","Email sent using PHP via msmtp");
?>