-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Setup Mailserver
For sending E-Mails to your Kindle, Pocketbook, Smartphone or Tablet you need to setup a e-mailserver in Calibre-Web. The corresponding settings are found in the admin section "Edit E-mail Server Settings".\
If you have installed google-auth-oauthlib and google-api-python-client you can choose to use a email address for sending emails without having enabled "less secure apps"
SMTP hostname is the mail-sending server, normally something like smtp.xxx.com. For correct setting of Port and Encryption, please look at the manual of your mail provider. SMTP login and SMTP password are the credentials you are using for sending e-mails. In the from e-mail please enter whatever you want to be shown in the "from field" on the receiver side (Some servers seem to be a bt pitty about what is entered here, you plain email-address should always work).
After finishing the settings you can check if the configuration is correct by hitting "Save setings and send Test E-Mail". Please check afterwards in the task section if the e-mail could be send successfully. If not you can change the loglevel to DEBUG and take a deeper look in the communication-packets and error messages exchanged (logfile calibre-web.log in the root folder of your installation for a manual installed Calibre-Web or in ~/.calibre-web if installed via pip).
The admin user has per default no Kindle-Email address entered, please enter a valid receiving E-Mail address into the corresponding field (admin section user admin, user's own profile settings page).
Make sure to have installed google-auth-oauthlib and google-api-python-client from the optional-requirements.txt file.
Go to the Google Developer Console and create a new app. https://console.developers.google.com. If you are using the Google Drive integration, some steps can be skipped and you can use the same oauth key for Gmail and G-Drive
- After login create a project:
- Choose a name and save the project:
- Activate the API for the created project by clicking on enable APIs and services or API library
- Choose Gmail API from the listed Apps
- Enable the Gmail API by clicking on enable
- Click on create credentials in the following screen:
- Choose Gmail as API, select user data and go to the next screen
- Select a name for your App enter user support and developer email address (can all be the same and identical to the account email you are using)
- On the following page select the scopes of the API you want to use (it's optional). Tick "gmail.send" and "userinfo.email"
- On the next screen select "Desktop app" the name can be left on the default value
- On the next screen you can download the credentials in a json formatted file. Download the file rename it to gmail.json and put it into the calibre-web root folder or in ~/.calibre-web for installations via pip
- Last step (not necessary if you have enabled G-Drive and are providing a valid callback path). Enter the name of the email account you want to use as test user. Click on Oauth consent screen and then on Add users, enter the email address. It should show up in the test users list afterwards
- Finally, restart Calibre-Web and go to admin section "Edit E-mail Server Settings" and change Server Type to Gmail Account with OAuth2 Verification. Click on Setup Gmail Account
If public registration is enabled you can limit the domains of e-mail addresses which are allowed for registering. Per default all domains (*.*) are allowed. You can use "*" for limiting to any number of characters and "?" for limiting to exact one character. If you want to limit the domains, please make sure to delete/edit the "*.*" entry. Entries can be deleted by clicking on the trashcan symbol and edited by clicking on the entry.
- Enter shell of the docker container
- Inside docker app: get PID of current calibre app:
ps -C "python3 /app/calibre-web/cps.py" -o pid=
- Run the following command to kill the current calibre-web and restart it to get realtime output in terminal:
kill [PID FROM STEP 2] && python3 /app/calibre-web/cps.py &
- Click on "Setup gmail account as email server" button in Calibre-Web.
- Copy link in terminal and open in any browser. Follow prompts and Allow access.
- Copy the link from browser (will fail) and paste in docker container:
curl "LOCALHOST LINK FROM BROWSER"
Keep the double quotes around the link. - Exit container shell and restart container, then test email send. Should work.
Src: https://github.com/janeczku/calibre-web/issues/2254#issuecomment-1100838560