As per https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36766#c30 we should set the from_address of the email sent by sftp_file.pl to ReplytoDefault and only fallback to KohaAdminEmailAddress if it is not set.
Created attachment 173592 [details] [review] Bug 38282: Set ReplytoDefault as the preferred from_address of sftp_file.pl Default to KohaAdminEmailAddress if ReplytoDefault is not set Test plan: 1. Enter a valid email address into ReplytoDefault and KohaAdminEmailAddress sysprefs 2. Apply patch and restart services 3. Generate a file on your Koha server. Place it in /tmp/test.mrc 4. Manually connect to the SFTP remote host and accept the hostkey 5. Enter Koha shell 6. Run the sftp_file.pl command-line script ./sftp_file.pl --host <your remote hostname> --user <your user> --pass <your password> --upload_dir <your upload directory> --file /tmp/test.mrc --email <your email> 7. Confirm the SFTP was successful 8. Confirm that the email that you received has a from address matching the ReplytoDefault syspref 9. Empty out the ReplytoDefault syspref and repeat steps 5 and 6 10. Confirm that the new email you received has a from address matching the KohaAdminEmailAddress syspref Sponsored-by: Catalyst IT
Thanks for requesting the follow-up in https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36766#c30 Katrin! I've attached the follow-up patch here. Hopefully it does what you are after, if not I can amend it as needed :)
Created attachment 173739 [details] [review] Bug 38282: Set ReplytoDefault as the preferred from_address of sftp_file.pl Default to KohaAdminEmailAddress if ReplytoDefault is not set Test plan: 1. Enter a valid email address into ReplytoDefault and KohaAdminEmailAddress sysprefs 2. Apply patch and restart services 3. Generate a file on your Koha server. Place it in /tmp/test.mrc 4. Manually connect to the SFTP remote host and accept the hostkey 5. Enter Koha shell 6. Run the sftp_file.pl command-line script ./sftp_file.pl --host <your remote hostname> --user <your user> --pass <your password> --upload_dir <your upload directory> --file /tmp/test.mrc --email <your email> 7. Confirm the SFTP was successful 8. Confirm that the email that you received has a from address matching the ReplytoDefault syspref 9. Empty out the ReplytoDefault syspref and repeat steps 5 and 6 10. Confirm that the new email you received has a from address matching the KohaAdminEmailAddress syspref Sponsored-by: Catalyst IT Signed-off-by: David Nind <david@davidnind.com>
Testing notes (using KTD): 1. Test plan notes: . See comment #21 from bug 36766 for notes on how to set up KTD to use an SFTP server. . To set up KTD to send email using a Google account, see [1]. . To receive the emails for step 8 of this bug's test plan (this bug), you need to run misc/cronjobs/process_message_queue.pl 2. Because of the way sending email works when using a Google account (I think), the from address in the actual emails you receive is always the email address for your Google account (the 'User name' setting). 3. However, if you read the output from running misc/cronjobs/process_message_queue.pl, then the 'From:' address will be the address you set in ReplytoDefault, and if that is empty it will show the address from KohaAdminEmailAddress. 5. So, I think testing with a real SMTP server would have the correct from addresses for the emails you actually receive. [1] Set up KTD to use a Gmail account for sending email (for testing purposes only) =========================================================== To test sending emails using a Google account: 1.1 Set up an App password for your Google Account (search the internet for how to do this). 1.2 Edit /etc/koha/sites/kohadev/koha-conf.xml file and add this configuration near the end (where <user_name> = your Google email address; <password> = your APP password, not your Google account password): <smtp_server> <host>smtp.gmail.com</host> <port>587</port> <timeout>5</timeout> <ssl_mode>STARTTLS</ssl_mode> <user_name>GOOGLEACCOUNTUSER</user_name> <password>GOOGLEAPPPASSWORD</password> <debug>1</debug> </smtp_server> OR (preferred, easiest) 1.3 Configure a new 'SMTP Server' under 'Administration > SMTP servers' using the following settings where `User name` = your Google email address and `Password` = your APP password, not your Google account password: Host: smtp.gmail.com Port: 587 Timeout: 5 SSL: STARTTLS User name: GOOGLEACCOUNTUSER Password: GOOGLEAPPPASSWORD Debug mode: Enabled Default server: select
Hi David, Thanks so much for testing. I'm sorry I dont think this follow-up is required after all. I attached the above commit (as a follow-up) onto https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36766 so Katrin could include it in main. So the commit on this bug report should already have been upstreamed. I'll mark this bug report as resolved fixed. Sorry again for not making that clearer here! Alex
No worries!