Lets take a look at the following scenario:
I have a websitesite, site.com. One customer support tech guy has an email account on it: techguy#site.com. Customers send messages to that email, tech guy replies via that email. They are both using desktop email clients (thunderbird, outlook...).
What I know is: using php to read incoming mail from customers
What I want to know is: how to use php to read outgoing mail that the tech guy is sending from his client via smtp, imap..
This would be used for archiving conversations between techs and customers without forcing them to use some php app on the site to send emails (I want them to use desktop clients).
I dont know much about email protocols, but I have plenty of experience in php. Im guessing that the email daemon could be setup to call a php script every time it recieves an outgoing email or something like that. Is there any way that this can be done?
The way how some products on the market are doing it is by requiring the user to install a plugin on his/her email client. Using this method doesn't matter what smtp server is used, the mails will be logged using the plugin.
Another way(this is just an idea) is to "force" the tech guy to use your smtp server so you can access the logs and see who sent mails and who is the receiver(accessing the logs using php)
It would be much easier to have a separate email address for logging purposes and simply keep it in the cc or bcc field for all communication between customer support and clients.
since you can have php interpret the emails, the best thing to do is have a dedicated email address that gets piped to a script (i know this is easy to set up cpanel)
you have the client email support#domain.com which gets piped to the script - do what you want with it there.
then you have the script email back out to bob#domain.com with a from address as support-reply#domain.com - which is also piped to a script
when he replies to that, it goes to support-reply#domain.com which goes to a script, which in turn you would process, then forward back out to the client#google.com with a return address of support#domain.com
i think amazon uses a similar technique so that people can email each other back and forth, but they create coded email addresses and have a database to keep track of who they are going to and coming from.
Related
Ok, so here's a difficult question for me.
I have searched on Google for some solutions but I couldn't yet make it clear on my mind.
Do you know some way of sending a message through the website "internal messaging system" (it's working ok) and then (this is the difficult part), just as it happens with eBay or Freelancer or many others, if user answers to that message on his email box, that can go to other user website account?
How can I be able to do that?
Website is in PHP and I am using phpmailer and my server SMTP credentials to send emails.
I imagine it's probably needed some POP configurations in order to receive the emails and some way to create an individual and unique email address so when people answers, it can go directly to that user.
Btw, website is www.mf.pt.la
I understand that you don't want the email to end up in mailbox, but in database of your web application. This usually involves forwarding all email to some mailbox or matching a patern to an executable script. You have to consult your smtp server documentation, but it might be as simle as creating .forward file in mailboxes account home directory with this content:
|/path/to/executable/script
script will receive the email, including all headers on stdin.
Now you need a way to identify, who should receive the message.
If you can forward email based on patern, you can place some identifier into the email address, this is what facebook does.
Or you can look for In-Reply-To email header, there you will find Message-ID of the email you send to the user. But sure, you either have to set it or get the autogenerated from phpmailer. Again, consult the manual.
Then there will be the most difficult part, extract the message itself from the email body :)
If it's not possible to forward incoming emails in your case, you might still have luck with cron job executing script that will fetch new emails from POP3 (or IMAP) account.
I have special e-mail accounts on my web server (#mydomain.com). I want to run a php script automatically when one of these accounts get a new e-mail. For example: when info#mydomain.com address receives a mail, I want to run "receivedMail.php" file and read this new e-mail. I don't know where I will start or how can I do this.
You're wanting to pipe email received for a specific email address to a PHP script.
If your webhost has cPanel, this makes it very easy to setup. See:
http://kb.siteground.com/how_to_pipe_an_email_to_a_php_script/
Alternatively, if you don't have cPanel but have Exim mailserver, this will guide you on how to do this:
http://www.phpshare.org/articles/Piping-Incoming-Mail-with-PHP
Hope this helps!
You have to create a cron job calling your php file every 1 minute for exemple.
The script have to the derver and read the email.
This has nothing to do with web servers directly, Since web servers do not receive emails. So no .htaccess style files come into play. The email is received by a mail server, so that is where you have to get active. Two strategies are possible:
you use the possibilities to trigger an action as offered by your
mail server (typically the smtp server you operate). That obviously
depends on which mail server you operate, different software offers
different features.
you poll those email accounts on a regular base, using a standard protocol like POP3 or IMAP4. You can do this using any suitable client. When a new message is found whilst polling the account, then you trigger the action you wish.
Option 2. is probably easier to start with. So give it a try: create a php file which polls your email server. You can use the imap php extion for this, it supports all important email protocols. The extensions allows to easily detect and retrieve new messages. For each such message you can implement whatever action you wish. All that is left is to run this script on a regular base, say every 3 minutes, which is typically done using a cron system. There are many examples for this out there on google...
Have fun!
This has been a massive headache. We use Ning as a our platform for an arts event project. We want to ask our audience to upload photos to our website via an email address. The only issue is that Ning only will give us ridiculous email addresses for this purpose... such as photos34628234896#ourwebsite.com That hardly sticks in the mind!
So I thought, lets just forward emails from an easy to remember email address to the Ning's crazy one... BUT Ning doesn't allow any emails to upload photos if they are detected as being forwarded or redirected. I guess that detection is done through the email header.
So that is why I need a way to redirect an email to another address without that being reflected in the header info in the email. I thought perhaps Outlook receiving the emails from the easy to remember email address, then somehow resending them with a fresh clean header may be the answer? I can code in PHP, and run a home headerless ubuntu server on a domestic internet connection too if that may provide a better answer?
Any thoughts how I could achieve this goal?
If you can forward the email to your server you can have it piped to PHP which can then resend the email for you with whatever email address you wish to be displayed. Just make sure you have things like DomainKeys and SPF records set up for that server or else your chances of the mail being seen as spam will increase.
If you are using an Exchange server, you can use Transport rules to redirect the message, which will pass most forwarding checks. If it does indeed change the headers or something else, you can use the same ruleset to remove or modify them. Most MTAs(Mail Transport) will allow the same sort of functions, but it really depends on which one you use. Postfix is quite flexible.
The changes will be made in
Exchange Management Console
Origanization Configuration
Hub Transport
Transport Rules
Also, and maybe easier, you could simply try to add a secondary delivery address, in the mail flow settings for the fictional user you assign to receive the emails. This would be done in the user properties. Server level forwarding amy not trigger the forwarding blocks that you are encountering, as client forwarding does not work the in entirely the same way. Many clients send the email again, but the server redirects it.
Exchange Management Console
Recipient Configuration
Mailbox
Properties, Mail Flow Settings.
You would enable forwarding in Delivery Options.
Sorry, just noticed that you are using ubuntu, you can simply have postfix redirect the email for you, you will use Postfix Virtual Alias Maps...
Here is a link that describes it perfectly...
http://www.cyberciti.biz/faq/linux-unix-bsd-postfix-forward-email-to-another-account/
I'm developing a web application which will send email notifications to users (including sender, subject, and message) if he gets new email in GMail. I can easily code for notification modules, but I don't know how to find and get emails. I'm having a free hosting account at x10hosting.com. I thought to create a email address in the mail domain of my x10hosting account and forward my emails to that address at x10hosting. Even if I forward it, how do I detect incoming emails and their counts, subject, message, etc. and how do I execute a PHP script which will take care of the notification module.
How about enabling the gmail account for pop or imap and using PHP to test that. You cant have a php web page that will automatically know - you will need to execute the script again and again to poll for new mail.
PHP really isnt the best solution for this.
I'm working on a website that allows you to send emails without registering, and without specifying a sender. You enter the recipient's address, subject, body and send. My problem is sending the message. What I'm trying to achieve:
User clicked send -> Subject,recipient,body sent to PHP -> Server validates the information -> Server creates a random email account -> Server sends the email through the random account created -> Server deletes the account
I'm stuck at the random email account creation step. How do I achieve this with PHP without having to pay for my own SMTP server and without having to use my own gmail/hotmail account.
I googl'd the hell out of this issue and I can't find an answer.
Thanks!
BTW
I'm using Apache to "host" on my own Ubuntu
How do I achieve this with PHP without having to pay for my own SMTP server and without having to use my own gmail/hotmail account.
The way to create E-Mail accounts varies wildly from server software to server software, and is usually not possible from within PHP.
Depending on your server's configuration, though, that might not be necessary: If you set up a catch all address for a domain, many server configurations will allow you to send out mails from any E-Mail on that domain (e.g. 123456789#example.com). Any responses will then go to that catch-all mailbox, the contents of which you will probably want to discard.
You have to realize, though, that this is exactly how spam providers operate. Extreme caution is advised if you don't want to end up on all sorts of spam blacklists.
I don't believe you can create accounts or email accounts on a server, using PHP, as this supersedes PHP's permission level. Sending emails this way is a good way to get your server banned, FYI. Also, if you insist on sending emails like this, why not just specify a dummy From: email address? It would essentially be the same thing as creating a dummy account anyhow.
You may also want to use the -f switch, for PHP's mail(). See php.net/manual/en/function.mail.php