I don't know if there is a easier way to do this, im starting out with php, I am trying to add a link to a email letter so that once the link is pressed it opens a webpage and auto submits a form to my email address with just a reference number that was added to the link.
I have tried a few ways with php but can only get a blank email to arrive.
Use an id(identifier) with the link. Use the id later to track who had opened the link.
When sending email add a parameter to link ("?referer=xyx23") and save the refere in database. When user opens the link you can track using the database the referer
You need add link with the unique get-parameter, like: http://your-site.com?sendemail=9adb879856464.
This parameter saved in the database. If user enters the site using link from email at the server run the script, this script checks, if is the link valid. If link is valid, check is the link in the database. If this link is in the database, then send the mail using php mail-function. If you want user used link once, delete the link in the database.
Related
how i can retrieve data from data base using PHP code. and then send these data to another person through the required email. i want php code that send data to each one, one by one in pdf form, on the email address included in the record by clicking one button
please cheek this link and implement this..
https://www.jotform.com/help/126-How-to-send-Submissions-to-Your-MySQL-Database-Using-PHP
am trying to put a button in the email created with php so that when the user gets that email, they can click the button to delete a record in the database directly without leaving the email client or email window they are in.
is it possible and how do i achieve that? Thanks.
The closest you can get I think is putting in a hyperlink to a web page which will automatically trigger the deletion when given the correct parameters. But it will still launch a web browser (and then a server-side script must run to do the deletion or whatever). And therefore you'll probably want to provide some feedback to the user on that page as well.
No, this is not possible. At best your email will contain a link that will spawn a new window or tab that will access a page to delete the record.
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.
Is there a way that I can have a "download file" link on a website but one that only downloads the file once a visitor has entered their email address into a form first?
Kind of like this system that Premium Pixels has, where you have to be a member to download things - http://www.premiumpixels.com/freebies/social-media-sharing-buttons-psd/
I would use a session if you want the user to be able to download multiple files but only enter their email address once.
On the link send them to a form which posts to a PHP page, then it processes that form and if the user did enter an e-mail then set the session to true e.g.
User clicks download
Check if session for download is yes/valid/true
if session isn't valid
Show basic HTML form asking for e-mail
Process HTML form and set the session for download yes/valid/true
Show "real" download link
EDIT:
As Blaze mentioned the best bet is to send the link to the e-mail to ensure that they provide THEIR e-mail and not someone elses
Rather than sending a direct link to the file once you have verified the user, it would be better to keep the file in a protected directory on your web server and send it to the users browser using readfile. So take the form page, process the input and validate it, if your validator is happy and the form is submitted have it provide the download. The file should pop up as a download in the users browser without sending a direct link. You should be able to get it working using the example in the PHP docs as your guide.
I'm developing a website where in it will list names from database as links. I'm already up to the point that when one user clicks on the name, it will pass the name's details to another page to view the email format etc. I just need a suggestion on how I can do this as I'm not an expert with php yet. I'm still studying more advanced codes. So,
clicks on the name,
views the details as an email and a confirmation button,
send the mail. I just need suggestions on how to make this easy. I am getting to know the script for mail(). Thanks
EDIT :
Since, there are a lot who think it's confusing. I just need advice on how I will pass data from one page to another then email.
What do you mean by getting the names as links?. do you have the link field in the database which is retrieved along with the name?
This is the solution based on what I understand from your vague question:
You have names which are retrieved from the database. Also retrive the id from the database. Display these names as links pointing to a different PHP page. lets name the php page as user.php. so the link will be:
$name = "You go this name from USER TABLE";
$id = "YOU GOT THIS ID FROM USER TABLE";
$name
Now in your user.php, retrive the id
$name = $_GET["userID"]; // make sure you do some parsing to avoid sql injection
// Retrieve all the information about this guy like email address etc from the database
// put everything into a form with a Confirm button which when clicked will mail it to the individual
// I think you should be able to figure out the mail part.