I upgraded a server recently that had a very simple email sender running, written in Python. The script was started repeatedly by a cron job, it read new messages from the database and sent them via SMTP protocol.
The upgrade of Ubuntu triggered a waterfall of upgrades from database, to database library, to newer Python, which resulted in an unsupported mailer library. I solved all issues, but it took me an hour or two. So I thought to myself that I should try porting this small utility to Rye when I find some time.
Rye is based on Go-lang, and Go has a very good gomail library. Email construction in general is quite complex or at least messy. With various headers, mime types, multipart bodies, attachments, encodings, quoted printables, etc. which gomail seems to handle perfectly.
Above are two examples, first a more low level, gomail like api for constructing and sending email messages, then the one that uses more of Rye arsenal.
Not all things in the examples are 100% implemented yet, but I will implement them in next weeks. For example, the Spreadsheet type that is returned by a query doesn't work with "for" and "->" yet.
Thing that interests me the most is if adding the Rye's specific failure handling will make the code much messier (I think it shouldn't). If I will do that I would like to compare it to equivalent code in Python for example.
Rye is on github.
Komentarji
Objavite komentar