Guide for installing PlexEmail?

Status
Not open for further replies.

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
It looks like it's just a python script. Any reason you can't just run it anywhere on your system?
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I had a look at this today, installed and configured in it's own jail. Not done one before, but an attempt at some instructions below:

1. Create new Jail (default options, I'd called it plexemail)
2. Add storage to the plexemail jail pointing to your plexdata folder in your plex jail (my destination was /plexms)
3. From the CLI in the jail run:

Code:
pkg upgrade
pkg install py27-sqlite3 py27-requests apache24 nano
git clone https://github.com/jakewaldron/PlexEmail.git
mkdir /usr/local/www/apache24/data/plexemail
cp -R /PlexEmail/web/ /usr/local/www/apache24/data/plexemail


Update 03/05: I've update the above code as the mkdir and cp command were the wrong way around!

4. Edit the config.conf file with relevant details:

Code:
nano /PlexEmail/scripts/config.conf


nb: you’ll need to change the path to the plex media server storage link (mine was /plexms) and web folder (/usr/local/www/apache24/data) along with SMTP settings for your e-mail service.

5. Run the plexEmail script:

Code:
python2.7 /PlexEmail/scripts/plexEmail.py


6. Set-up a weekly Cron job to run the script:

Code:
crontab -u root -e
59 23 * * 0 python2.7 /PlexEmail/scripts/plexEmail.py


nb: Hit the 'i' button to set vi into 'insert mode'. Copy & paste line 2 into the editor, then hit the "Escape" button then ":" then "w" then "q" then "enter"

Alternatively, you can create a Cron task in the FreeNAS GUI with the following command:

Code:
jexec plexmail python2.7 /PlexEmail/scripts/plexEmail.py
 
Last edited:

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
What's the source and destination paths for the jail storage?
Source is your Plex data inside the Plex jail.
Destination is wherever you like in relation to being inside the jail you're setting up. /media/plexdata for example
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
My Plex Media Server jail was built using these instructions > https://forums.freenas.org/index.ph...all-plex-in-a-freenas-9-3-jail-updated.19412/

So my source location is /mnt/APEpool1/jails/plexms/usr/local/plexdata (where 'APEpool1' is the name of my pool and 'plexms' is the name of my PMS jail) and I pointed it to /plexms in my plexemail jail. It looks like this:

preview
 
Last edited:

AstroZombie

Explorer
Joined
Jul 20, 2014
Messages
76
Running into this error when I test the script:
hERrSSm.png


These are the storage source and destination for the jail:
tsABFtW.png



These are the paths in the config:
cWOoBPp.png
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I'd try 'pkg install py27-sqlite3' which might fix the error (pretty sure this was installed in my default jail, but I'll add above)

I think you also need to change the plex_data_folder line in config.conf to '/media' as this is where you've mounted the PMS source in your plexemail jail.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I think so. Change - plex_data_folder = '/media' - and try again ;)
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Your web_folder is the same as mine - /usr/local/www/apache24/data

I've just had a quick look and the folder above contains the contents of the /PlexEmail/web/ folder but also has a 'plexemail' folder. Running the python script creates the index.html file in this folder.

Try mkdir /usr/local/www/apache24/data/plexemail
 

AstroZombie

Explorer
Joined
Jul 20, 2014
Messages
76
Seems to be fine just got a email from google preventing a sign in from an un-authorised device, I assume that's a simple fix in the config file to do with ssl?

tyG2Zqp.png
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
You should be able to see the output by putting the plexemail jail IP address into your web browser, but I suspect it's worked from the 'Web page created successfully' message :D

Not sure about Gmail settings, as I've got a hosted domain and e-mail service, but my e-mail settings looks something like this:

##Email
email_enabled = True
email_individually = False
email_use_bcc = False
email_to = ['receiving@email.com']
#This requires plex_username and plex_password to be filled to get emails of shared users.
email_to_send_to_shared_users = False
email_unsubscribe = ['']
email_from = 'sending@email.com'
email_from_name = 'Plex Server'
email_smtp_address = 'smtp.server.com'
email_smtp_port = 465
email_use_ssl = True #Port must be an SSL port i.e. 465
email_username = 'sending@email.com'
email_password = 'password'
# Only valid if web_enabled = True and upload_use_cloudinary = False
email_use_web_images = True
email_skip_if_no_additions = False
 

AstroZombie

Explorer
Joined
Jul 20, 2014
Messages
76
Here's the thing I have the
email _to
blank as i have the plex username and password filled in so it can pull my shared user emails from there.

With
email_to_send_to_shared_users
as True to facilitate this.

All the rest is the same.

Would i have the receiving email be the sending email to in this case and put
email_to_send_to_shared_users
as false?
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
You've lost me there!

I didn't want any test e-mails going out to my Plex Users, so just entered the e-mail address I wanted to receive the output at email_to = ['receiving@email.com'] i.e. this has my personal e-mail address here, so adrian@mydomain.com

I'd left email_to_send_to_shared_users = False although I might switch this on after a few weeks once I know it's working.

The email_from = 'sending@email.com' is the address I use for all my freenas alerts i.e. freenas1@mydomain.com and the username and password are the ones required for this e-mail account. If you are planning on sending and receiving from the same gmail account, then I guess these are the same?
 

AstroZombie

Explorer
Joined
Jul 20, 2014
Messages
76
Ok so little update i turned on unsecure apps in my google account and copied your settings (putting in all shared users on my plex emails manually)
and got this:

0jB3k8m.png


only thing is i have no idea where it went i'm assuming to the first email in the list.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Did you include your own e-mail?
 
Status
Not open for further replies.
Top