I can't seem to find a way to be able to send a completely raw email with swiftmailer in php (or with any emailer to be honest).
By completely raw I mean the email itself is the actual string already encoded with header, body, attachment etc already in it.
I don't need to or want to construct the message with ->addTo() and such, I have the complete email string, just needs to be sent.
Does anyone know a way to do this?
Thanks
Related
We're receiving automated emails, which have a CSV attached. Using PHP, I'm grabbing mail via IMAP. I can grab the eMails and attachments no problem. However, the CSV's are attached as octet-streams.
How can I convert that to something I can actually work with? Currently when reading the contents, I'm just getting stuff that looks like this:
NzA1MTA1NTgxMzAsODgxDQo3MDUxMDU1ODEyMCw1NzkNCjcwNTEwNTU4MTEwLDQ3MQ0KNzA1MTA1==
Use base64_decode().
http://php.net/manual/en/function.base64-decode.php
Better yet, look at the encoding headers in the e-mail so that you know whether or not something is actually encoded the way you expect.
what are the security issues about mail.body? i want to know when i want to send an email with a form using php, except the email address that we have to validate that, is there any other security issue about sending emails?
for example, which characters can't be used in the body? what about the header or subject? is there any problem with using new line in the body? is a black list applicable here? also, is it possible that with using some tags like <script> in the body, sending email be failed?
all papers that i have read, only say about validating email address and not more!
im researching about security and i want to know all issues about email security in PHP.
Plain text is basically safe. HTML or (shudder) Flash or PDF has the inherent security problems of those formats. In theory, all mail should be 7bit, but MIME changed that so that internaltional information can be handled. The Wikipedia MIME article is probably a good place to start. http://en.wikipedia.org/wiki/MIME
I am currently using Zend_Mail_Storage_Imap to read email messages using IMAP. I am able to read the email body (text and html) thanks to the documentation.
Now I'm trying to figure out how to save email attachments. I can't find anything that explains how to convert the raw content and save the attachments. How can I do this?
Try these:
http://macfoo.wordpress.com/2009/06/10/save-an-email-attachment-using-zend-mail/
http://www.electrictoolbox.com/function-extract-email-attachments-php-imap/
I found that reading emails using Zend_Mail can be a little buggy. Sometimes not all of the attachment files are recognized or in some cases imap can't even decode the body of the email .
We're using Sendgrid service to parse emails now, and it's working pretty well. They have a special api to decode emails. on the downside, it cost money, but I prefer better results.
Is it possible to send a MIME message as it is, without adding any headers? For example, if I have a correct MIME message with all headers and content saved to a text file, is it possible to use the contents of this file without modification and send it via SMTP?
Apparently both python's SMTP.sendmail and PHP smtp::mail require at least "To:" and "From:", and passing the complete message to these functions doesn't seem to work.
It appears from the documentation that python's SMTP.sendmail should take a sender, a set of recipients, and a verbatim MIME message like the one you have. (The split here between the sender/recipients and the message itself is because you're talking SMTP. The SMTP envelope determines the actual recipients and is actually independent of the message payload.) So you should be good to go with SMTP.sendmail.
You could read up to the first blank line, use those as additional headers, then send the rest in the body.
I understand there are php IMAP functions to extract certain elements from an email stored in a mailbox. What I am trying to discover is whether this can translate to emails piped to a script.
The scripts that I have looked at for extracting the body and attachments are fairly inflexible and bulky. I sent my pipe script a variety of different email formats and it saved them in vastly different ways which makes me wary of starting to write a script myself.
Also as some of the emails sent from my work address attach a signature. Does anyone have any ideas how to combat this. I have a bunch of rather daft people who won't even understand the term 'don't add a signature when sending this email', or 'send in plain text only'.
AFAIK, the format for storing messages is not defined by any RFC however deliver, procmail and .forward all rely on the the headers being seperated from the body by a blank line.