Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email sent from backup task fails on Windows 11 #100

Open
ckewinjones opened this issue Aug 19, 2024 · 1 comment
Open

Email sent from backup task fails on Windows 11 #100

ckewinjones opened this issue Aug 19, 2024 · 1 comment

Comments

@ckewinjones
Copy link

The email functionality of backup.ps1 fails on my Windows 11 install of restic-windows-backup. The error log shows the following:

Send-MailMessage : Unable to read data from the transport connection: net_io_connectionclosed.
At C:\restic\backup.ps1:337 char:9
+         Send-MailMessage @ResticEmailConfig -From $ResticEmailFrom -T ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpExcept 
   ion
    + FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage
 
[[Email]] Sending email completed with errors

Per the documentation of the Send-MailMessage cmdlet, Send-MailMessage is obsolete and has been deprecated in favor of the Send-MailKitMessage cmdlet available in PSGallery. I have fixed this in my own installation of restic-windows-backup by

  • Adding code to install.ps1 to install the Send-MailKitMessage module
  • Fjxing the Send-Email function to use Send-MailKitMessage in place of Send-MailMessage.

I will make my changes available in a pull request so that this change can be part of the next release of restic-windows-backup if that is wanted.

The failure occurs on my system running Windows 11 Pro 23H2. I don't know if it occurs on any earlier versions of Windows 11 or Windows 10. By the same token I don't know if my fix works on any other Windows version either. I would be willing to test other platforms (by spinning up VMs for each platform that needs testing) if that would be helpful.

@ckewinjones
Copy link
Author

See PR 101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant