Raspberry Pi 3, fax


https://wp.me/ph3BR-27R


sudo apt-get update
sudo apt-get upgrade -y
sudo rpi-update
sudo reboot


sudo apt-get install hylafax-server sendmail -y --force-yes
find /sys/bus/usb/devices/usb*/ -name dev

tty/ttyACM0/dev is my USB fax modem found

 

special note, install sendmail, did not workout

uses ssmtp and gmail, works for single fax to email address, do not know why

Normal fax line, testing is expensive and wasting money, try local loop fax line, uses +12V battery and two 1K resistors to pull up the fax line, it is used to simulates phone line power of telephone company, no dial tone, and manually answering fax machine for testing, or abort (not working on Pi 3), on Pi 3 terminal


sudo faxanswer -h fax ttyACM0

sudo faxabort ttyACM0

 

restart hylafax


sudo /etc/init.d/hylafax restart


sudo faxsetup

 

 

Uses Gmail account and Pi 3 to send email to yourself for testing
reference:
https://stackoverflow.com/questions/38391412/raspberry-pi-send-mail-from-command-line-using-gmail-smtp-server

Google account setting
# Login to your gmail account
# Go to: Settings -> Accounts and Import -> Other Google Account settings
# Go to: Personal info & privacy -> Account overview
# Go to: Sign-in & security -> Connect apps & sites
# Set option Allow less secure apps to ON

 

Now, on Pi 3, this is complete and tested command line script
copy and paste to Pi terminal, will run.
on Raspberry Pi 3, terminal,

 
## Install SSMTP & GEDIT, for send email, Gedit for GUI text editor, easy than uses vi
sudo apt-get install ssmtp gedit

## Save & copy original conf file to be .bak
sudo cp /etc/ssmtp/ssmtp.conf /etc/ssmtp/ssmtp.conf.bak

## Create new conf file (with vi, or some other text editor)
## sudo vi /etc/ssmtp/ssmtp.conf

## open GUI editor as root previlage, edit /etc/ssmtp/ssmtp.conf
gksudo gedit /etc/ssmtp/ssmtp.conf

 

 

————- ssmtp.conf, file content is following————
root=your_account@gmail.com
mailhub=smtp.gmail.com:587

FromLineOverride=YES
AuthUser=your_account@gmail.com
AuthPass=your_password
UseSTARTTLS=YES
UseTLS=YES
# Debug=Yes

————- ssmtp.conf, file content is end————

 

 

on Raspberry Pi 3, terminal again,

## Secure conf file
sudo groupadd ssmtp
sudo chown :ssmtp /etc/ssmtp/ssmtp.conf

## If you have error on this step like ''cannot access'' ...
## you must find ssmtp file and use that path: sudo find / -name "ssmtp"

sudo chown :ssmtp /usr/sbin/ssmtp
sudo chmod 640 /etc/ssmtp/ssmtp.conf
sudo chmod g+s /usr/sbin/ssmtp

## Sending mail to yourself, from (only one) command line 
echo "This is a test echo by command line" | ssmtp your_account@gmail.com

## or
printf "To: your_account@gmail.com\nFrom: RaspberryPi3\nSubject: printf Testing send mail from Raspberry\n\nThis is test. \nBest Regards\n" | ssmtp -t

 

 

build test.txt as email template for testing,

gksudo gedit test.txt

 

 

——————– content of test.txt———————
To: your_account@gmail.com
From: your_account@gmail.com
Subject: Testing send mail from Raspberry, by send test.txt file

This is test mail (body)

Best Regards!

——————– content of test.txt end——————–

 

 

 

on Raspberry Pi 3, terminal again, Now you can send mail from file

ssmtp your_account@gmail.com < test.txt

 

 

How to send photo as attachment
on Raspberry Pi 3, terminal again, Now you can send mail from file
ref : https://unix.stackexchange.com/questions/381131/simplest-way-to-send-mail-with-image-attachment-from-command-line-using-gmail

sudo apt-get update
sudo apt-get install mpack
mpack -s "test photo" /home/pi/test_photo.png your_account@gmail.com

 

command line to open photo viewer with root previlage, able to view fax by received hylafax, /var/spool/hylafax/recvq

gksudo gpicview

 

Viewing faxes through internet browser

To do that install apache web server, then add a link to your faxes

apt-get update
apt-get install apache2
cd /var/www/html
ln -s /var/spool/hylafax/recvq fax

 

broswer to open http://localhost/fax/

廣告

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 /  變更 )

w

連結到 %s