How to create RFC822 email message with comment inside message? - email

I'm uploading messages into my IMAP mail server via IMAP store operation. However, I would like to add "comments" to these messages so that when I download these emails again I know the they are created by "store". Basically, I need to add text which will be ignored by the formal semantics of parsing RFC822.
The specification of http://www.ietf.org/rfc/rfc822.txt defines how to add comments but I cannot make it working :(
Does anybody has en example of a RFC822 message with a comment in it?

You are probably looking for IMAP's annotations. However, it's an extension which is far from being common -- quite a lot of IMAP servers do not support it.
It seems that having a special "flag" on each message you created is something which would be enough for you. If that is correct, then simply using IMAP flags (or keywords) is what you're looking for. Simply add one special flag, like thisIsProducedByFooSoftware to the APPEND operation. (You said you were doing that via STORE -- that's wrong, in IMAP, STORE manipulates just FLAGS, it doesn't add new messages. New messages are added by APPEND.)

Related

How to send multiple emails in MODX in single SMTP session?

I have a script that sends multiple emails in a loop. Between every email, I reset modMail:
$modx->mail->reset()
Sending becomes really slow since modMail needs to connect to the SMTP server again. I would like to send all emails in a single SMTP session.
I found that PHPMailer has a method clearAllRecipients but the modMail class does not have it. So the following command does not work:
$modx->mail->clearAllRecipients()
Is it safe to call PHPMailer's method directly with the following command:
$modx->mail->mailer->clearAllRecipients()
I am a little worried that something will get later broken if the PHPMailer changes. Or what would be a better solution?
PHPMailer's API isn't likely to change in any way like that precisely because it would cause BC breaks. Doing what you suggest should work just fine, though remember you'll need to also set SMTPKeepAlive = true to make it do this. See the reference implementation in the PHPMailer mailing list example.
If you think that this is something that other modx users would benefit from, you could add it to the wrapper they provide (and submit a PR for it) so that you can be abstracted away from PHPMailer's internal API, and thus protected from future changes that way.

SendGrid API Limitations questions

This document here: https://docs.sendgrid.com/api-reference/mail-send/limitations
States the following:
Unicode encoding is not supported for the from field.
The to.name, cc.name, and bcc.name personalizations cannot include either the ; or , characters.
So I tried a test email to see what happens. I put emojis in the From name, and I sent to a To name of "John,;;, Doe;". There was no error and the email was successfully delivered.
Am I misreading these limitations? I want to make sure that what I build is correctly validating what it sends to the API, but these limitations don't seem to be correctly stated.
While I don't know exactly what the limitations are within SendGrid, I would imagine those limitations were written for a reason. It may well be the case that SendGrid itself can handle each of those characters, but the mailbox you are sending to may not. Obviously the test email that you sent handled those characters too, but that may not be the case for all mailboxes and you could cause yourself delivery problems if you try to send messages that conflict with these stated limitations.
I would stick within the guidelines for the best possible outcome.

Encrypted S/MIME E-Mail with un-encrypted part possible?

I would like to know whether it is technically possible to created an S/MIME-encrypted E-Mail that also contains un-encrypted part. The idea is that the user would see the un-encrypted part, if and only if the message could not be decrypted (e.g. missing private key). Otherwise, if the message can be decrypted, the encrypted part will be displayed to the user as always.
A possible solution would be to wrap the whole S/MIME structure into a "multipart/alternative" MIME structure. One part would be "text/plain" containing some info text, the other part would be "application/pkcs7-mime" containing the actual (encrypted) payload.
However, I cannot find any information on whether S/MIME does allow this. Also it would be important to know if standard Mail-Clients can handle such construct in the intended way.
Thanks in advance for any information!
Yes, MIME allows this. Whether you'll find any mail clients that support sending it is a completely separate matter.

Email to rss on server

for my group at the university I'd like to set up a server-sided email-to-rss service.
It should work like that, that different people can send emails to a certain address (nothing proprietary like gmail but a certain imap or pop server) which will the be translated into an rss feed. One main and important feature has to be that one can see the sender of the email in the feed. Furthermore it would be nice (to take the load off the server) if the emails get translated to a feed only once a day or so.
Does anyone has some input on this subject? Are there any scripts/services which will allow that?
Thanks a bunch.
Instead of "reinventing the wheel", you could use a mailing list that supports RSS. Your people can then write the mails to the mailing list and you can then use the mailing list's RSS feed however you intend to.
This should help you find a solution: https://encrypted.google.com/search?q=mailing%20list%20rss
Pick a programming language you're familiar with, then use either an imap library to fetch the E-mails (through cron, every hour or something like that), or if you have access to procmail on your mail server, launch your script as an email arrives (this shouldn't be too much work to handle for a server, unless you're talking a vast amount of E-mail).
The script would just insert the E-mails into a database, before extracting them and outputting the RSS-feed directly from that (this shouldn't be more than a handful of lines of code).
There's a couple of providers that does this for you, although it seems that the most popular ones have disappeared. Advanced Email2RSS seems to be an option, although I have no idea how good they are or if it'll even solve your issue.

Get mail signature programmatically

How I can get the mail signature (like "sent from my iphone") programmatically.
A signature is simply some constant text automatically added to the end of a message by the software that sent the email. There is no way to programmatically distinguish it from the rest of the message.
There was a tradition where newsgroup and email signatures would begin with a line starting with two dashes to allow for easy automated filtering, but this seems to have fallen by the wayside as use of the internet expanded and certainly is not observed by the automated signatures added by most devices.
Realistically, if you want to filter away the automated signatures, the best thing to do would be to build a list of them and then use that list to recognize them. This won't work for arbitrary signatures, though, only ones on your list.
You can't. There is no publicly documented way to do this in the iOS SDK.