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.
Related
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 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.
So a component in an app I'm currently developing sends a confirmation email to whoever the user puts in as their "emergency contact" which simply states that the user has chosen them to be the contact.
What I also want to do, which is what I'm stuck on, is embed a URL in the email that the "emergency contact" would click to confirm that they are fine with being the contact.
Once clicked, the status "confirmed" in the database would have to change to "true", and from there the app can act differently based on an (if confirmed == true) kind of thing.
Everything is currently built in AS3, with PHP and SQL acting as the backend user database (URLLoader being the connection between AS3 & PHP).
If anyone needs me to be more clear, or give a better example of what I currently have just let me know.
The actual nuts and bolts depends on how you built your server code and how fraud-proof you need your system to be, but in the simplest form the link in your email would be something like:
Click here to confirm.
for the html version of your email. (How you format the email is going to be determined by what libraries you're using to send it, but you will be able to send a message with HTML and non-HTML text that the email client can choose between.)
When clicked this would send a message back to your server with the proper email that you could then mark as confirmed. If you're using a framework, you would probably have a controller named 'confirm', or if not, a file called confirm.php that handles the response.
Note this has no protection whatsoever from fraud; anyone could send that confirmation message. You could add another random field in the link that would be authenticated on the server to improve things a bit, if necessary. Beyond that we're getting into an entirely different discussion.
For anyone else wondering how to send a confirmation code, check & validate confirmation etc.. this is a really good link that I ended up referencing, which really helped!
http://pastebin.com/rc89rggc
Kudos to Irwan who wrote it.
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 have an application that works this way.
I have a users table in mysql with user id and all data
This is what happens:
a) A user signed up to my site(A) goes to another website(B) and answers some question.
b) The website(B) Sends me email with data of a user who is in my database.
now what i want to do is automatically whenever an eamil about a particular received in my inbox. The code in php detects the user id and saves the mail in emailrep field of my database.
Please tell me how can i achieve this in PHP???
I think this is a good start
Reading Emails with PHP