PlexEmail - Email Recently Added Media

Yes starting right here:

My line numbers are using Notepad++ lines 480-612

def createWebHTML():
  htmlText = """
      
  <head>

      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <meta name="description" content="">
      <meta name="author" content="">

      <title>""" + config['msg_web_title'] + """</title>

      <!-- Bootstrap Core CSS -->
      <link href="css/bootstrap.min.css" rel="stylesheet">

      <!-- Custom CSS -->
      <link href="css/one-page-wonder.css" rel="stylesheet">
      
      <link rel="shortcut icon" href="images/favicon.ico">
      <link rel="apple-touch-icon" href="images/icon_iphone.png">
      <link rel="apple-touch-icon" sizes="72x72" href="images/icon_ipad.png">
      <link rel="apple-touch-icon" sizes="114x114" href="images/icon_iphone@2x.png">
      <link rel="apple-touch-icon" sizes="144x144" href="images/icon_ipad@2x.png">

      <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
      <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
      <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
          <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
      <![endif]-->

  </head>

  <body>

      <!-- Navigation -->
      <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
          <div class="container">
              <!-- Brand and toggle get grouped for better mobile display -->
              <div class="navbar-header">
                  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                      <span class="sr-only">Toggle navigation</span>
                      <span class="icon-bar"></span>
                      <span class="icon-bar"></span>
                      <span class="icon-bar"></span>
                  </button>
                  <a class="navbar-brand" href="#">""" + config['msg_top_link'] + """</a>
              </div>
              <!-- Collect the nav links, forms, and other content for toggling -->
              <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                  <ul class="nav navbar-nav">"""

humm...images for email dont show but they work in webpage

eadwyn,

I am still struggling with the email individually option.  It works when I run "plexEmail.py -t" with the option of email individually set to true, but when I run it normally I get the following Error.  Any help would be greatly appreciated.  Also it works fine if I don't use the email individually option.

C:\Python27\Scripts\plexEmail>plexEmail.py
Web page created successfully
Traceback (most recent call last):
  File "C:\Python27\Scripts\plexEmail\plexEmail.py", line 1051, in
    sendMail(email)
  File "C:\Python27\Scripts\plexEmail\plexEmail.py", line 366, in sendMail
    server.sendmail(FROM, TO, msg.as_string())
  File "C:\Python27\lib\smtplib.py", line 742, in sendmail
    raise SMTPRecipientsRefused(senderrs)
smtplib.SMTPRecipientsRefused: {'': (555, '5.5.2 Syntax error. k71sm6958089qhc.4
2 - gsmtp')}

eadwyn,

I am still struggling with the email individually option.  It works when I run "plexEmail.py -t" with the option of email individually set to true, but when I run it normally I get the following Error.  Any help would be greatly appreciated.  Also it works fine if I don't use the email individually option.

C:\Python27\Scripts\plexEmail>plexEmail.py
Web page created successfully
Traceback (most recent call last):
  File "C:\Python27\Scripts\plexEmail\plexEmail.py", line 1051, in
    sendMail(email)
  File "C:\Python27\Scripts\plexEmail\plexEmail.py", line 366, in sendMail
    server.sendmail(FROM, TO, msg.as_string())
  File "C:\Python27\lib\smtplib.py", line 742, in sendmail
    raise SMTPRecipientsRefused(senderrs)
smtplib.SMTPRecipientsRefused: {'': (555, '5.5.2 Syntax error. k71sm6958089qhc.4
2 - gsmtp')}

I email individually, and it works. Here's my config file's email section, with email addresses redacted:

##Email
email_enabled = True
email_individually = True
# ['email1@gmail.com', 'email2@hotmail.com']
email_to = ['xxx@xxx.com', 'xxx@xxx.com', 'xxx@xxx.com', 'xxx@xxx.com', 'xxx@xxx.com', 'xxx@xxx.com', 'xxx@xxx.com', 'xxx@xxx.com', 'xxx@xxx.com', 'xxx@xxx.com', 'xxx@xxx.com', 'xxx@xxx.com', 'xxx@xxx.com']
email_from = 'xxx@xxx.com'
email_from_name = 'Rico\'s PLEX Server'
email_smtp_address = 'smtp.xxxx.com'
email_smtp_port = 587
email_username = 'xxx@xxx.com'
email_password = 'PASSWORD'
# Only valid if web_enabled = True and upload_use_cloudinary = True
email_use_web_images = True
email_skip_if_no_additions = False

Just make sure your syntax is correct, and you should be fine. It should be noted that I do not use gmail, I use my company's email server, which runs on Office365. I've heard gmail can be tricky to get working.

Tycho,

On page 16 I had asked about maybe using BCC so all of my users do not see each other's email address.  Eadwyn mentioned just to set the email_individually to true and it would still use the same Shared Users list from Plex.  With all of that being said, I don't have anything in the email_to field.  Just the default [''] that is there.  If I add test emails to that field they go out fine, but I don't see anything going to my shared user list.  Maybe it is just a gmail issue....

The only way now to do this is to make a change to the code of the PlexEmail script. If you are not running on Windows you can edit the scripts/plexEmail.py file by putting a # at the beginning of lines 761 and 762 for movies.

What is the start of the line exactly because depending on if you add code to the file the number can point to other code.

humm...images for email dont show but they work in webpage

I figured this out. Had to use my URL + port number instead of my forward URL

What is the start of the line exactly because depending on if you add code to the file the number can point to other code.

For me it was Line 772 and 773

if ('original_title' in movies[movie] and movies[movie]['original_title'] != ''):
        title += movies[movie]['original_title'] + ' AKA '

Ok, 

So email works great in gmail but not so great in Outlook.com, the new Google Inbox and yahoo mail...No real idea how to fix it

Outlook.com:

Google Inbox

Yahoo Mail:

Saitoh your gonna run into this problem because you can't use DIV's in email code which messes that up. I had remade that graphic so the numbers are in the center so it doesn't do that just haven't had time to show it yet.

As far as the images that localhost determines the images. You will need to put your external IP for this to work for your users.

Saitoh your gonna run into this problem because you can't use DIV's in email code which messes that up. I had remade that graphic so the numbers are in the center so it doesn't do that just haven't had time to show it yet.

As far as the images that localhost determines the images. You will need to put your external IP for this to work for your users.

I used my domain name that is tied to my External ip. So it has to be the ip to get support from the 2 sites? Yeah I figured it was the div tags.. Oh well most are on Gmail. Maybe I will look into it when I have more time.

Sent from my SM-G920W8 using Tapatalk

Tycho,

On page 16 I had asked about maybe using BCC so all of my users do not see each other's email address.  Eadwyn mentioned just to set the email_individually to true and it would still use the same Shared Users list from Plex.  With all of that being said, I don't have anything in the email_to field.  Just the default [''] that is there.  If I add test emails to that field they go out fine, but I don't see anything going to my shared user list.  Maybe it is just a gmail issue....

OK, so you need to have users emails listed after the "email_to =" and if you have "email_individually = True" then it will send one email to each user in the list. You don't need BCC because you dont send say 1 email to 20 users. You send 20 emails, one for each user.

It does not use any API calls to go out and find what all the email address are and send it for you. You need to put them in manually and administrate them manually (aka if you give someone the boot you will have to remove their email or they will still get them).

You can find all your user's emails by using this link.

https://plex.tv/api/users

Tycho,

On page 16 I had asked about maybe using BCC so all of my users do not see each other's email address.  Eadwyn mentioned just to set the email_individually to true and it would still use the same Shared Users list from Plex.  With all of that being said, I don't have anything in the email_to field.  Just the default [''] that is there.  If I add test emails to that field they go out fine, but I don't see anything going to my shared user list.  Maybe it is just a gmail issue....

Yeah, like I said, I think gmail is finicky. But like foebik says above, I had to manually add these email addresses, and list them individually with the proper syntax. I think Eadwyn added some functionality to PlexEmail to grab the email addresses from your Plex account, but I had already set up my jonx like this, manually. There are some people in this thread that got the gmail working, I think...

On a side note, I like the idea of customizing the HTML of the sent email, but this thread has this spread out all over the place. I'm hoping someone might compile a procedure in the future...   ;)

I got GMail working first shot. I think people are getting goofed up on the port number to use. It's been a while so I don't know how much of this was default but here is what my config looks like.

email_from = 'XXXXX@gmail.com'
email_from_name = 'XXXXX Server'
email_smtp_address = 'smtp.gmail.com'
email_smtp_port = 587
email_use_ssl = False #Port must be an SSL port i.e. 465
email_username = 'XXXXX@gmail.com'
email_password = 'XXXXX'

OK, so you need to have users emails listed after the "email_to =" and if you have "email_individually = True" then it will send one email to each user in the list. You don't need BCC because you dont send say 1 email to 20 users. You send 20 emails, one for each user.

It does not use any API calls to go out and find what all the email address are and send it for you. You need to put them in manually and administrate them manually (aka if you give someone the boot you will have to remove their email or they will still get them).

You can find all your user's emails by using this link.

https://plex.tv/api/users

Got it, and thanks for the clarification, I'm not sure why I thought that it would do the API call and send them individually, but that would be a nice feature.  Anyway, Thanks!

Dave

OK, so you need to have users emails listed after the "email_to =" and if you have "email_individually = True" then it will send one email to each user in the list. You don't need BCC because you dont send say 1 email to 20 users. You send 20 emails, one for each user.

It does not use any API calls to go out and find what all the email address are and send it for you. You need to put them in manually and administrate them manually (aka if you give someone the boot you will have to remove their email or they will still get them).

You can find all your user's emails by using this link.

https://plex.tv/api/users

Got it, and thanks for the clarification, I'm not sure why I thought that it would do the API call and send them individually, but that would be a nice feature.  Anyway, Thanks!

Dave

You can still use the api call and send emails individually using "email_individually = True".

I have had mine setup this way since the api call was added.

If you want to receive the email yourself (the owner is not included in the api) then put your own email at "email_to = ['you@email.com']"

I'll have to add a new config option whether or not authentication should be used.  I'll try to get you something later when I get home from work.

Sorry for nagging, understand you have alot to do:)

Just want to verify if you have this in your pipeline for a fix soon?

Sincerly

Hello all, thanks for this add-in to Plex.  I don't quite have it up and running, I have I thought worked out most of the bugs but I cannot seem to figure this one out.

C:\Python27\Scripts>c:\python27\python plexEmail.py
Traceback (most recent call last):
  File "plexEmail.py", line 1027, in
    with open(config['web_folder'] + config['web_path'] + os.path.sep + 'index.h
tml', 'w') as text_file:
IOError: [Errno 2] No such file or directory: 'plexEmail\\index.html'

Anyone have an idea I have figured out (I think) I have localhost listed in config file as the web hosting, and I have not installed nor setup a local hosting for a website, is this what my problem is, I thought I could do everything via, Cloudinary, all my pictures uploaded, I didn't get anymore email errors but also no emails went to anyone.

Thanks for your help and again this program will be a Godsend for me to let my extended family know that new videos of the kids have been posted.

Thank you,

John

jclancy103

 

howdy all

love this script its awesome

i have a quick question … can i somehow add a way to display the native resolution in the email of what is added so when it emails out it displays like this

The Longest Ride
Two couples. Two love stories. One epic tale.

The lives of a young couple intertwine with a much older man as he reflects back on a lost love while he’s trapped in an automobile crash.

Genre(s): Drama, Romance

Star(s): Scott Eastwood, Britt Robertson, Lolita Davidovich

Runtime: 128 minutes

Year: 2015

Rating: 71%

Quality: 720p

After some troubles, got my script working last night and thought I would post the solution in case it might help someone else.

This was the error I was getting:

C:\Python27\Scripts>python “C:\PlexEmail-0.6.0\scripts\plexEmail.py”
Traceback (most recent call last):
File “C:\PlexEmail-0.6.0\scripts\plexEmail.py”, line 656, in
cur.execute('SELECT machine_identifier FROM remote_servers WHERE url LIKE “h
ttp://127.0.0.1%”
sqlite3.DatabaseError: file is encrypted or is not a database


After some quick research, I found this article:

Version mismatch between sqlite CLI and python sqlite API


I didn’t think that was exactly my issue, but figured I would give it a try.

Here was my solution:

  • I renamed the copy of sqlite3.dll in the Python\DLL’s folder as sqlite3.dll.OLD
  • I copied the file sqlite3.dll from “C:\Program Files (x86)\Plex\Plex Media Server” and copied it over to “C:\Python27\DLLs”

Success!

C:\PlexEmail-0.6.0\scripts>plexemail.py
Web page was not created because the option is disabled in the config file.
Successfully sent 1 email(s)

Happy Plexing!

hello
is what someone might make a Detailed tutorial on windows
because I tried several times but nothing was not for lack of reading
not easy for the novice

thank you