Sending emails fails with 400 (Bad request)

Today I wanted to add an email account to my seafile pro (v6.0.4) instance so I do not have to copy/paste share links to emails.
I added my email account information to, deleted seahub_settings.pyc (just to make sure the information is really updated) and restarted seafile and seahub.

If I try to send a link now, first seahub displays “sending” for a few seconds, then a “Internal server error”-Message is displayed in the modal.
Looking up the Console in Chrome, I found that a 400 error is issued (Bad Request) for the resource: https://my.seafile.domain/share/link/send/

This is also found in seahub_django_request.log:

2016-12-19 15:40:41,573 [WARNING] django.request:170 get_response Not Found: /share/link/send/

My (E-Mail part only):

EMAIL_HOST_USER = 'my@email.address'
EMAIL_HOST_PASSWORD = 'myCorrectPassword'

My nginx config: (without ssl-config etc.)

location / {
    fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
    fastcgi_param   PATH_INFO           $fastcgi_script_name;
    fastcgi_param   SERVER_PROTOCOL     $server_protocol;
    fastcgi_param   QUERY_STRING        $query_string;
    fastcgi_param   REQUEST_METHOD      $request_method;
    fastcgi_param   CONTENT_TYPE        $content_type;
    fastcgi_param   CONTENT_LENGTH      $content_length;
    fastcgi_param   SERVER_ADDR         $server_addr;
    fastcgi_param   SERVER_PORT         $server_port;
    fastcgi_param   SERVER_NAME         $server_name;
    fastcgi_param   REMOTE_ADDR         $remote_addr;
    fastcgi_param   HTTPS               on;
    fastcgi_param   HTTP_SCHEME         https;
    access_log      /var/log/nginx/seahub.access.log;
    error_log       /var/log/nginx/seahub.error.log;

location /seafhttp {
    rewrite ^/seafhttp(.*)$ $1 break;
    client_max_body_size 0;
    proxy_connect_timeout  36000s;
    proxy_read_timeout  36000s;

location /media {
    rewrite ^/media(.*)$ /media$1 break;
    root /home/seafile/seafile-server-latest/seahub;

Unfortunately, there is NOTHING related to email in any of the log files.
I’m pretty sure that this is a routing error…
Any ideas, where to search next?


Does your SMTP-Relay support sending TLS via Port 587? I would try this, since we had similar problems with Port 465. I think it is django related or something.

1 Like

Maaaaan, what a nasty thing.

@marcusm: is a PAIN. They have their website plastered with informations about using port 465 with SSL/TLS/STARTLS. It got me so confused. Usually SSL/TLS is used on port 465. STARTTLS default port is 587. That’s quite clear. doesn’t even mention 587. Like: not. at. all.

What I did then was to check on my own. 465 with ssl (which seafile doesn’t support out of the box), 465 with STARTTLS. 587 with STARTTLS and 587 with SSL/TLS. Nothing.

Then I setup a new mail account and tested it from thunderbird with 587/STARTTLS.
Now guess what?! does like google, only without being cool and offering a “less secure apps” option. They only accept well known user agents. Once you try to connect without a proper user agent, your connection gets rejected. Narf :dizzy_face:

Next thing to do: Learn to fake the user agent with django. :smiley:

Or use another hoster :wink:

Fun thing: I will have to setup my own mail server for the domain I use. At least I can then blame myself for such things. But I’ll try to make it work anyway! :smiley: