I want to build a system where the user can just reply to the email he gets. What it needs to do is: once the user replies to the email, that email does not go to any user, it will execute a url with GET parameters that triggers a script that updates the database and send another user an email.
Let me explain again:
User A gets into the system to insert his message, his message will send a notification to User B, user B replies to it, but instead of sending to User A, it will Update a database and notify User A saying that User B has sent a message.
the main point is that User A and B does not communicate with each other directly, only allowing them to communicate using the system.
I need to use PHP.
If someone can help or point me into the right direction I will appreciate it!!
Thank you all!!!
If you have access to the system users, you could pipe within the .forward file to a php script.
Or run a php script via cron/wget that logs into that email account and processes emails.
You need a email server, which will be receive and sent messages.
And just read new emails with PHP and do another magic that you want with PHP IMAP functions.
Related
We have a script that executes different actions when a user clicks on a specified URL from within the received email. We are getting random records in our database as soon as we send the email to the user. We've checked that we do not have any PHP functions that execute those URLs. So we ask here, is it possible that a URL within an email body can be auto-executed by an email client?
No, that wouldn't be a good thing.
i got strucked with a task! can anyone help me out... if a user opens his emailid in iphone iwant to mail "hi", if the same user opens his email in android "hello" should be sent and if the user opens in windows "hey" should be sent.
"$_SERVER['HTTP_USER_AGENT']" will gives the device info after clicking on it.. but the conditions should be worked before user gets a mail based on its device name.
php and javascript will not work in the email. The only way you can achieve this behavior is that thisis an email first it will store the data of the user such as name, email and etc. In this factor I will recommend when you get the user data include what device the user is using. In this way you can manipulate your greetings for the user.
Please check following scenario,
First I am sending email to user using php
Whenever user viewed this email, I want to update my user table.
Is it possible?
Usually you'd put some resource to your email (like an image/tracking pixel) that is loaded from your server. The url of that resource is actually an url to your script. Once the client app tries to load the resources your script gets executed. You get the params you set when sending the email and do what you want with them.
Keep in mind that not all email clients will behave this way. For example plain text email viewers will not load any resources.
I want to send a welcome email when a user registers in my app.
When a user registers he gets redirected to his profile page.
I tried sending email while user creation but the email() takes 7 seconds to send email, and the page waits till then and then redirects the user to profile after 7 sec.
This is not desired. I want to redirect user as soon he registers, and send an email along the process. It takes 7 sec don't know why. i tried it online on godaddy and hostgator account as well as on my localhost.
BTW: i am using PHPMailer to send email.
How can can i make a standalone process which on invoke calls my sendMail.php with email $_POST[] parameters {to, subject, body}.
i though ajax call will do the trick, but as soon as my page redirects from registration to profile, the email script stops.
I tried this code:
<script language="JavaScript">
$.post( "sendMail.php", { to: "$to", subject: "$subject", htmlBody: "$htmlBody", altBody: "$altBody" } );
location.href=profile.html
</script>
Please help, i searched a lot but they work on shell which i am not, and other solutions were unix/linux based. i want to make it work on xampp as well as godaddy linux shared hosting, with NO ssh access.
You could use Mail_Queue, which is a job queue specifically for sending emails, or utilise Zend_Queue [ZF1, ZF2] to write something customised to work with PHPMailer. You might even consider using Gearman.
You could try to put the javascript in your profile page so it runs once they hit the profile page and not on the form submit. Just need to check if the welcome email has been sent already in you sendMail.php script.
But using this script to send an email may not a very good idea as it could enable a malicious user to send an email with what ever content they wanted to whoever they wanted and if it was marked as spam then it would be your server that got blocked. It is a very common technique used by "spammers".
You would have to be very careful in how you handeled the email before it was sent so as not to breach your agreement with your hosting company.
Php is single threading language. This means that you can not start a job before previus one executed (and finished)...
You may change task order. I mean you may send the email, after welcome page completely rendered.
Try with this order;
1) register user
2) show welcome page,
3) send welcome email....
with this order, your new user will not wait for 7 seconds before see welcome page.
I would like to know how to setup a system in php that I could send emails to and the email content would poblish on my blog as a new post and the email subject would be the new post title.
Am not using word press or any of those blogging platforms am running my own blogging script and a php 5.x version.
I don't even know how to get started on this kind of programming challenge please any one with any ideas is welcomed.
Joe
You would need to create a script that is able to read from your email account. Php has the IMAP library that enables you to read email messages. Check this link to see how you could use the library.
You would need to schedule the script to be run at a periodic interval of time (eg. every 5 minutes). In Linux you would setup a cron job to do it.
So, I mean the script should be invoked periodically. If it finds a new message, it would then update your blog by taking the body of the email.
you need to set up a database that has all the tables and rows necessary to hold all the vital information about the post that people will send via email. then using MYSQL in your PHP file you need to connect to the database (host, username, and password) and then create your own query to enter the desired data to the database.