We wanted to set up some infrastructure that would send mail through a shared icloud account. Here's how we did that:
- Set up icloud account.
- Set up AppleID for said icloud account / the mac(s) running the infrastructure.
- Fully log in to your Apple ... stuff. Mac, icloud, apple ID, etc. You must use two-factor authentication to do so.
- Go to your AppleID management interface, once fully logged in and authenticated.
- Create an "app specific password."
You should now be fully set up and ready to go! Invoke your
script. Let's assume your icloud account is
myfakeaccount@icloud.com. This should be it!
123456789 | python mailer.py \
--user myfakeaccount \
--passwd <app specific password in the format: aaaa-aaaa-aaaa-aaaa> \
--host smtp.mail.me.com \
--port 587 \
--from_addr myfakeaccount@icloud.com \
--to_addr <your address> \
--subj "Your subject" \
--attach your_file.txt
|
If that doesn't work, well, check the
reference document we used to get going and see what's wrong.
Work based on a
previous reference: my python script to send mail on MacOS. (As previously mentioned, on Linux I just use mail/sendmail.) I believe interacting with this script is cleaner and simpler. The password is hardcoded, but for the automation infrastructure we're using, something has to store the password, so why not the caller? We can probably do better ... but.
Script after the jump.
We recently needed to clone some SD cards - or, more precisely, copy a directory structure. Apparently SD card cloners are kind of expensive. We didn't really need a block-type copy, just a standard copy, so I whipped up a script. Details after the jump.