简体   繁体   中英

PHP Pear Mail on reception

I would like to know if there's any way I can send a automatic answer to client when I open them mail who's comming from my website ?

Anybody have sugestion ?

Has asked here is more information:

I Have a online cart who send me a e-mail when I receive order, I would like that when I open the order there's a email automaticly been sent to the client to tell him that i've took his order. Like when you open a e-mail and that tell you that the sender asked to receive a confirmation that you've received the mail.

For resume I would like that when I receive a order mail, and open it there anoter email who's sent directly to the client telling him that i've openned his order and processing it.

You can create a script on your website, for example 'mysite.com/confirmread.php'. In this script you can write code to send an e-mail to the customer. Then, in the e-mail that is sent to you on the customer's order, you can create a link towards this script. You can click the link then, for example: 'mysite.com/confirmread.php?ordernr=2883992' or 'mysite.com/confirmread.php?mail=customer@domain.com'.

Another way might be an automatic script that is fired once you open your e-mail. I'm thinking of a javascript / ajax script, which calls the same script (confirmread.php), but without you having to click the link. I'm not sure to which extent scripting is supported in e-mail clients (think of the difference between online vs offline mail clients).

You can, of course, also reply the e-mail to another address of your own. For example sale@mysite.com. This address can then be read by the PHP script. But I guess that's more complex.

You have to hook into the IMAP server and check the status of the emails periodically. And when on changes its status from unread to read you can send an email. But this means you have to track the status of the emails in a separate database against this DB you have to check then if the email was already read.

Better solution: Add into your order mail a link at the bottom which links to a script which sends an email to the customer. So, you have to manually trigger this email but its very easy to implement.

Example in pseudo code:

Link at the bottom of the order email:

yourserver.com/sendEmailThatOrderWasReceived.php?orderid=123&customerEmail=test@example.com

Script on your server:

<?php 
mail($_REQUEST['customerEmail'], 'Order '.$_REQUEST['oderId'].' is confirmed', 'Thank you for your order, we had a look at it.');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM