How can I send an email from Mac Terminal using a bash shell script?
How can I send an email from my Mac Terminal using a bash shell script?
I have tried the following shell script:
send_email.sh
but I did not receive anything in my Mail app Inbox.
#!/bin/bash
recipient="b*****7@**mail.com"
subject="Testing..."
body="This is the body of the email"
echo "$body" | mail -s "$subject" "$recipient"
I typed this at the bash prompt:
bash send_email.sh
I have an Apple Silicon MacBook Pro with Sequoia 15.5.
I have searched on Google for any help but I cannot get any further forward.
Can anyone help?
[Edited by Moderator]
MacBook Pro 16″, macOS 15.5