Problem trying to debug problem sending mails ("Invalid type Microsoft.WindowsAzure.Storage.Blob.BlobEncryptionPolicy")

Hello,
I’ve had some issues due to a full temp folder, which I discovered only after two weeks without successful backups. Therefore, I thought, there must be a way to get notified immediately whenever something goes wrong. So I added send-mail to the options of my backup. But I don’t get any mails. I found threads regarding similar problems (
How to set up email notification with Gmail and Setting up email via web-interface not working SOLVED ) and followed the advises but without any success.

Since the web interface did not show any errors, I tried to use the command line interface to get more feedback via:

duplicati-cli --verbose send-mail --send-mail-to="me@gmail.com" --send-mail-username="me@gmail.com" --send-mail-from="me@gmail.com" --send-mail-url=“smtps://smtp.gmail.com:465” --send-mail-password=“crypticPassword” --send-mail-subject=“test”

But using this command, I only get this output:

Input command: send-mail
Input arguments: 

Input options: 
verbose: 
send-mail-to: me@gmail.com
send-mail-username: me@gmail.com
send-mail-from: me@gmail.com
send-mail-url: smtps://smtp.gmail.com:465
send-mail-password: crypticPassword
send-mail-subject: test

Invalid type Microsoft.WindowsAzure.Storage.Blob.BlobEncryptionPolicy for instance field Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions:<EncryptionPolicy>k__BackingField
Invalid type Microsoft.WindowsAzure.Storage.Queue.QueueEncryptionPolicy for instance field Microsoft.WindowsAzure.Storage.Queue.QueueRequestOptions:<EncryptionPolicy>k__BackingField
Invalid type Microsoft.WindowsAzure.Storage.Table.TableEncryptionPolicy for instance field Microsoft.WindowsAzure.Storage.Table.TableRequestOptions:<EncryptionPolicy>k__BackingField

The output does not change even if I specify an obviously wrong smtp server. However, the invalid type errors indicate that something does not work as intended. But that’s the point at which I don’t get any further using my debugging powers. I found an issue at github Invalid Type errors when calling mono Duplicati.CommandLine.*.exe but according to it, the error should be fixed by version “2.0.2.6_canary_2017-09-16”. Currently I’m on v2.0.2.17-2.0.2.17_canary_2018-01-23.

Any ideas how to resolve these problems?
Best,
Jan

It’s very odd that you’re getting WindowsAzure errors on a send-mail test.

Is Azure the destination for one of your jobs?

(By the way, I edited your post by putting “>” in front of the command line so it stands out a little better.)

I get the error for every duplicati-related command I run. Even

duplicati-cli help

returns

Invalid type Microsoft.WindowsAzure.Storage.Blob.BlobEncryptionPolicy for instance field Microsoft.WindowsAzure.Storage.Blob.BlobRequestOptions:<EncryptionPolicy>k__BackingField
Invalid type Microsoft.WindowsAzure.Storage.Queue.QueueEncryptionPolicy for instance field Microsoft.WindowsAzure.Storage.Queue.QueueRequestOptions:<EncryptionPolicy>k__BackingField
Invalid type Microsoft.WindowsAzure.Storage.Table.TableEncryptionPolicy for instance field Microsoft.WindowsAzure.Storage.Table.TableRequestOptions:<EncryptionPolicy>k__BackingField

See duplicati.commandline.exe help <topic> for more information.
  General: example, changelog
  Commands: backup, find, restore, delete, compact, test, compare, purge
  Reparing: repair, affected, list-broken-files, purge-broken-files
  Debugging: debug, logging, create-report, test-filters, system-info, send-mail
  Targets: aftp, amzcd, azure, b2, box, cloudfiles, dropbox, ftp, file, googledrive, gcs, hubic, jottacloud, mega, onedrive, openstack, s3, ssh, od4b, mssp, tahoe, webdav
  Modules: aes, gpg, zip, 7z, console-password-input, mssql-options, hyperv-options, http-options, sendhttp, sendmail, runscript, sendxmpp, check-mono-ssl
  Formats: date, time, size, encryption, compression
  Advanced: mail, advanced, returncodes, filter, <option>

http://www.duplicati.com/              Version:  - 2.0.2.1_beta_2017-08-01

(And thanks for editing!)

I also remember those errors. Not sure when. They have nothing to do with your email. Nothing in your spam folder either?

I guessed that the WindowsAzure errors are not directly related to the email problem but I don’t get any other error message even if the login credentials are deliberately wrong. Therefore, I don’t get a hint about why it does not work. And no, there are no messages in the spam folder.

You’re running on a Mac, right?

If so, then you may be running into the same thing as mentoined here:

That topic mentions that it might be “a packaging error”, but doesn’t suggest how to solve it (though my guess is re-install).

I’m running Duplicati on Linux (Ubuntu 16.04). A reinstall of the experimental version (v2.0.2.15-2.0.2.15_experimental_2018-01-03) solved the WindowsAzure problem. Thanks for the hint!
Unfortunately, I still don’t get any feedback from duplicati-cli regarding problems sending the email (nor do I get the emails).

Great! Now we can get to the email issue. :slight_smile:

Can you post what shows in the CLI when you run the send-mail command now?

The output remains the same (without the WindowsAzure messages).
Actual input with deliberately wrong credentials:

duplicati-cli --verbose send-mail \
--send-mail-to="me@gmail.com" \
--send-mail-username="me@gmail.com" \
--send-mail-from="me@gmail.com" \
–send-mail-url=“smtps://smtp.gmail.com:465” \
–send-mail-password=“crypticPassword” \
–send-mail-subject=“test”

Output:

Input command: send-mail
Input arguments: 

Input options: 
verbose: 
send-mail-to: me@gmail.com
send-mail-username: me@gmail.com
send-mail-from: me@gmail.com
send-mail-url: smtps://smtp.gmail.com:465
send-mail-password: crypticPassword
send-mail-subject: test

I have also checked if a mail is sent if I enter the correct credentials but it did not work.

Thanks for your patience. I’m pretty sure the issue you’re running into is SSL certificate related.

Try your command one more time but include --log-level=profiling and I suspect you’ll get out put that includes something like this what I’ve included below.

If so, then the “easiest” solution is to include the suggested --accept-specificed-ssl-hash=xxxxxxxxxx parameter which should get things working.

...
log-level: Profiling

Starting - Running SendMail
Running SendMail took 00:00:00.027
Failed to send email: System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
 => The remote certificate is invalid according to the validation procedure.
Dispose for True failed: The server certificate had the error RemoteCertificateChainErrors and the hash...
~~~

Thanks for your help! And I’ve got good news:
I added the log-level option and got this output:

Input command: send-mail
Input arguments: 

Input options: 
verbose: 
send-mail-to: myaddress@gmail.com
send-mail-username: myaddress@gmail.com
send-mail-from: myaddress@gmail.com
send-mail-url: smtps://smtp.gmail.com:465
send-mail-password: crypticPassword
send-mail-subject: test
log-level: profiling

Starting - Running SendMail
Running SendMail took 00:00:00.010
Failed to send email: System.IO.IOException: The authentication or decryption has failed.
--> System.IO.IOException: The authentication or decryption has failed.
--> Mono.Security.Protocol.Tls.TlsException: Invalid certificate received from server.
 => The authentication or decryption has failed.

This error led me to The authentication or decryption has failed.. There it was mentioned that the error occurs even though the option --accept-any-ssl-certificate was activated. Since this sounded close to your guess about the SSL certificate, I added the option and now it works!

For reference, this is the final command I used (I changed the login credentials):

duplicati-cli --verbose send-mail
--send-mail-to="me@gmail.com"
--send-mail-username="me@gmail.com"
--send-mail-from="me@gmail.com"
–send-mail-url=“smtps://smtp.gmail.com:465”
–send-mail-password=“crypticPassword”
–send-mail-subject=“test”
–log-level=profiling
–accept-any-ssl-certificate

And this is the corresponding output:

Input command: send-mail
Input arguments: 

Input options: 
verbose: 
send-mail-to: me@gmail.com
send-mail-username: me@gmail.com
send-mail-from: me@gmail.com
send-mail-url: smtps://smtp.gmail.com:465
send-mail-password: crypticPassword
send-mail-subject: test
log-level: profiling
accept-any-ssl-certificate: 

Starting - Running SendMail
Running SendMail took 00:00:00.010
Whole SMTP communication: Connected to smtps://smtp.gmail.com:465/
S: 220 smtp.gmail.com ESMTP 15sm3854421eds.54 - gsmtp
C: EHLO [192.168.178.34]
S: 250-smtp.gmail.com at your service, [myIP]
S: 250-SIZE 35882577
S: 250-8BITMIME
S: 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
S: 250-ENHANCEDSTATUSCODES
S: 250-PIPELINING
S: 250-CHUNKING
S: 250 SMTPUTF8
C: AUTH XOAUTH2 dXNlcj1qcGFza2FyYmVpdEBnbWFpbC5jb20BYXV0aD1CZWFyZXIgS1dyUHBHaG9neAEB
S: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
C: AUTH PLAIN AGpwYXNrYXJiZWl0QGdtYWlsLmNvbQBLV3JQcEdob2d4
S: 535-5.7.8 Username and Password not accepted. Learn more at
S: 535 5.7.8  https://support.google.com/mail/?p=BadCredentials 15sm3854421eds.54 - gsmtp
C: AUTH LOGIN
S: 334 VXNlcm5hbWU6
C: anBhc2thcmJlaXRAZ21haWwuY29t
S: 334 UGFzc3dvcmQ6
C: S1dyUHBHaG9neA==
S: 235 2.7.0 Accepted
C: MAIL FROM:<me@gmail.com>
C: RCPT TO:<me@gmail.com>
S: 250 2.1.0 OK 15sm3854421eds.54 - gsmtp
S: 250 2.1.5 OK 15sm3854421eds.54 - gsmtp
C: DATA
S: 354  Go ahead 15sm3854421eds.54 - gsmtp
C: From: me@gmail.com
C: Date: Sat, 03 Feb 2018 11:15:06 +0100
C: Subject: test
C: Message-Id: <ABDHSS8YJ3U4.WD9YMQSFFOWO2@mypc>
C: To: me@gmail.com
C: MIME-Version: 1.0
C: Content-Type: text/plain; charset=utf-8
C: Content-Transfer-Encoding: 7bit
C: 
C: MainOperation: SendMail
C: Lines: []
C: VerboseOutput: True
C: VerboseErrors: False
C: ParsedResult: Success
C: EndTime: 02/03/2018 11:15:06 (1517652906)
C: BeginTime: 02/03/2018 11:15:06 (1517652906)
C: Duration: 00:00:00.3896080
C: Messages: []
C: Warnings: []
C: Errors: []
C: 
C: .
S: 250 2.0.0 OK 1517652909 15sm3854421eds.54 - gsmtp
C: QUIT
S: 221 2.0.0 closing connection 15sm3854421eds.54 - gsmtp

Email sent successfully using server: smtps://smtp.gmail.com:465

Thank you very much!

1 Like