Basically I've been asked if there is any way that I can capture & download all incoming and outgoing emails ( preferably in text format ) going through a mail server. This downloading method needs to be done using PHP or similar server side language.
If I can pass the above stage, then the final goal is easily reachable, which is to allow me process the emails via a script of some sort.
If there is any sort of mediating RPM I can install that would allow me to port emails to a directory somewhere, could also be of great help.
I am completely lost on where to start with this, so any sort of pointers or advice is greatly appreciated.
Thanks
Scott
More Info :
Server : CentOS
Mail Server : Pop3
"Downloading" email is the same is fetching email. Have a look at the PHP IMAP extension.
Plenty of examples there to get you going.
Related
I have this job creating a simple website for someone, a website that
should be able to send mails to any email address, and I'm having some trouble
making it happen.
I'm using a simple free file server (cuccfree), but I don't have access to the server itself, only to upload files to the htdocs folder. I also configured a mail address in my server, but mailing only work to the server's email address (When ever I ask the php file on server to send the mail to Gmail/Yahoo and such, it does not work).
I've searched Google for an answer but kinda got lost..
I'd really like some help about this:
I'm ready to switch to a better file server service (whether it's free or not) that can support configuring mailing service that would work, and would be glad to hear some suggestions for one.
I'd also love to be guided of how to configure the mailing service on that server.
Also, when thinking about this, there's a good chance that my server's mails are being blocked by Gmail/Yahoo and such, otherwise anyone could have just set a mail server and send as much mails as they want.. so is that possible that this is my problem? is there any way to solve this and kind of confirm with the mailing companies that I'm a legit website?
I'm really not familiar enough with this topic' and would really appreciate some help.
Thanks in advance!
Once or twice a year i find myself in the position of having to develop complex emails.
They often include Plaintext and Html versions, along with attachments and other headers.
Previewing the development using standard send/receive is painfully slow and tedious.
What i'm looking for is a local testing platform that processes the mail function and provides a mail client style preview with access to alternate views, headers, etc. Or possibly a real mail client that can take mail directly.
I've searched and searched but no luck so far, hopefully someone can point me in the right direction.
Thanks in advance. TT
I'm not sure if this is what you want but you can use your localhost mail and access it via thunderbird for example
How do I read local email in thunderbird? - Ask Ubuntu
Via this way you don't have to wait endless for mail to be delivered as it's local. And you can see your send mail in a actual mail client
I don't know any software but I had some good experience with the following online service: http://litmus.com/ It's somewhat like browserstack. (live crossbrowser testing tool)
I use Papercut, which listens to a SMTP port, catchs all e-mails and shows headers, source, text and html view. It's very useful!
I have now solved this.
In the php.ini file there is an option to set an export path for the mail function called sendmail_path.
I set this to tee mail.eml > /dev/null and it now saves the sent mail to the same directory as where the function is called and i simply open it with my mail client.
sendmail_path = tee mail.eml > /dev/null
2 notes on this.
this is a solution for unix platforms only.
the file extension has to be set to suit your chosen mail client
For a task like this I use fakemail for receiving the mails into a maildir and mutt for reading the mails. Mutt can also be configured for reading HTML mails.
If you just want to log the emails without reading them, you could use the "logmail" approach described in this article by Chris Shiflett:
Edit: The lastcraft.com host seems to be down at the moment, my Google search for "fakemail" revealed this Python project that might be helpful: https://github.com/isotoma/FakeEmail
If you're just looking to preview your HTML emails (and alternatively, if you need help designing them) you can sign up for a free MailChimp account. It's actually an email send service, but they also have an interface for a drag-and-drop email builder.
For your situation, you could use the "code your own" tool, drop in your HTML, CSS, plain text, etc. and then preview the email in all sorts of email clients, test at different screen resolutions, etc.
(*I am not affiliated with MailChimp)
You can also try https://github.com/ycecube/phpmaildebug.
It uses the php's sendmail output to capture the mails.
I am about to start a project that requires an email to be somehow ran through a PHP script. I have full control of the server that the email will be sent to and wondered if people could give me some thoughts or pointers as to the most elegant way parsing it with PHP. I am not editing the email and then forwarding it on.
The server is CentOS with Exim email.
Thanks in advance.
You implement a client for the mail box (php imap modules can work with pop3, imap4 and local mailboxes). You poll the mailbox for new arrived messages, retrieve new ones and parse it. All using the php imap module.
One of the best examples of this comes with Wordpress... there is a file wp-mail.php which is set up as a cron task to retrieve and parse emails... I have hacked it up several times to do such things!
To make life easier for you, rather that stress yourself with parsing emails (if you don't mind the cost) you could decide to use Postmark
I've been using their services for quite some time and i love them. They have an Incoming email API service now. Enough talk, simply check it out because I believe it will help with what you're trying to do.
There are three main approaches to this:
Run a cron task to poll an IMAP/Pop3 server every x minutes
Make exim run a script whenever it receives an email
Use a third party service to receive the email and send it on to your site.
I wrote a Blog Post detailing the options, although it's for Rails the main concept applies to any language including PHP.
I have a strange requirement.
I need to read the outlook emails from a local pc using php .
I will get user credentials.
so is there any way to do this ?
it need to work well in all major browsers.
Thanks.
Not sure why you would want to try to get this from a LOCAL mail file on a 'single' pc, I would rather attack this from a POP3/IMAP route, it would THEN be a PHP based mail client, or whatever you need it for (fetching mail, filtering, checking, triggering an event, etc;).
But what you describe is just not feasible for anything, I can't see a client paying to have simple client mail accessed via PHP.
Here are some PHP / Email reading references:
http://garrettstjohn.com/entry/reading-emails-with-php/
http://davidwalsh.name/gmail-php-imap
http://www.tuxradar.com/practicalphp/15/6/3
I need in some way to accept incoming emails to my web application and save them in the database. My web application is written in PHP language and im using MySQL database.
I have no idea how can i do that... I builded the rest of my web application by myself but this is very complicated for me.
For example i need to know how can i accept incoming emails first... and where? in which email address my web application will accept these emails...???
Then how i will get them from there? How i will process them and how i will store them in my database?
Please help me with an example, some piece of code, anything!
Any help is accepted.
Im not an expert so a piece of code will help me a lot.
Thank you in advance!
You basically have two choices:
Run an SMTP program (such as Postfix or Sendmail) on your server to receive the emails, and use procmail to pass them to your code
get an email account on an external host service and retrieve the email using one of the POP3 client packages for PHP, such as pop3class
Option 1 is much harder to do, and you have to learn about administering an email server, which is not a trivial task. Option 2 is relatively easy and is the one I'd recommend.
Easiest way would be to setup a regular email address with some freemailer and then check this account.
A start for this might be the POP3-class of PHPMailer.