I have a contact form where you specify the contact Information along with your email id. Once the form is sent it comes to my Inbox. The mail specifies the Information supplied by the user. I would like the sender of the contact form to receive a read receipt once I open the email.
This is what I have done so far
$name=$_POST['name'];
$email_address = $_POST['email'];
$subject='Contact Form Replies';
$phone=$_POST['phone'];
$message=$_POST['msg'];
$body = "You have received a new message. ".
" Here are the details:\n Name: $name \n ".
"Email: $email_address\n Phone Number: $phone \n Message: $message \n ";
$headers = 'From: ' .$email_address. ''.
$headers .= 'X-Confirm-Reading-To: '.$email_address. '';
mail('xyz#gmail.com', $subject, $body,$headers))
?>
Now as per this code the mail gets successfully delivered to my Inbox. But once I open the mail, the read receipt does not go to the sender. Kindly advice on how I can overcome this Issue
Most email (web) clients disable any ability for the sender to check if an email is opened. They disable JavaScript, disable external sources so this is only possible with a own email server where users all use the same software such as outlook to have a reliable result.
However one possible way is to add an HTML image linking to image.php?receit=1234 and let that load up a php script that returns a tracking pixel. Now you know the email is opened and the user clicked the button to show all images.
Related
Any idea why the [Enter email] field on this form will only reach me#me.com if the email entered matches me#me.com?
If I put in any other email address than the one listed in $to=, the email doesn't send.
$fieldname = 'images';
if ($_POST){
// we'll begin by assigning the To address and message subject
$to="me#me.com";
$subject="Registration";
$from = "<".stripslashes($_POST['email']).">";
// generate a random string to be used as the boundary marker
$mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
// now we'll build the message headers
$headers = "From: $from\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: multipart/mixed;\r\n" .
" boundary=\"{$mime_boundary}\"\n";
Here's a Pastebin.
You are setting the from header to be the address posted in the form, and the to header to be your email address. Should be reversed if you are trying to send an email to them.
$to="me#me.com";
$subject="Registration";
$from = "<".stripslashes($_POST['email']).">";
If indeed you want the email to appear to come from the address listed in the form, you can't in general do that. You can't send email on behalf of another use (your SMTP server is likely to reject it these days). This is to prevent pfishing attacks (FROM: Someone#ThatYouKnow.com, SUBJECT: What is that password again?).
Send it from an email address that you control. Include the email address from the form as part of the body of the email.
I am using the following code along with HTML for header .
$email="example#example.com"; in the example and I want to implement variable in its place.
Code as posted below but its not showing error nor sending email.
I have tried the following links PHP email form not sending information , PHP Sending Emails with File Attachments - Email Not Sending At All .
I have tried
$headers .= "From: <".$email.">\n";
and
$headers .= $email;
This displays $email in the label from header in email.
But its working fine till this line:
$headers .= 'From: ' .$email. "\r\n";
This above line is not sending email if I remove this line it works but it does not add From email id to the header.
Please help me out it does not show any error and I have tried many variations to the above code but still stumped.
<?php
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['contact'];
$subject = "feedback";
$question = $_REQUEST['question'];
$body = "<html>
<head>
</html>";
$mime_boundary = "<<<--==+X[".md5(time())."]\r\n\r\n";
$headers = "MIME-Version: 1.0"."\r\n" ."Content-Type:text/html;"."\r\n";
$headers .= 'From:'.$email. "\r\n";
$to ='example#example.com';
mail($to,$subject,$body,$headers);
echo "<script>alert(' message sent.');</script>";
?>
I had the same issue with one of the servers I were dealing with. Apparently in my server, not specifying "From" header sends email from the default mail address of your account (in case of a shared hosting). I chose this solution as an ad-hoc fix and specified my actual from address in "Reply-To" header. This way, I can still receive the replies sent to those email threads.
This method seems feasible for just functional email addresses (eg., support#example.com)only. If you are using this approach for a user's email address (eg., john#example.com), chances are that the recipient might think of your email as a spam.
if you use standard mail function, then try this(do not add "From" header to $headers):
mail($to,$subject,$message,$headers,"-f ".$email);
I have a contact form, the entire markup for which (other than the javascript) can be found here. The form sends an email with the information input by the user to whichever email is defined under to_email in an options panel.
I am using this form in WordPress and would like to have the IP address of the person filling out the form attached to the message. I tried incorporating code from this post but I'm a newbie to PHP and can't seem to incorporate it correctly (to actually send it with the rest of the message).
If anybody can offer help as to what code I should include and where I should include it to display the sender's IP address I would greatly appreciate it.
$body = "Name: $name \n\nEmail: $email \n\nComments: $comments";
replace with
$body = "Name: $name \n\nEmail: $email \n\nComments: $comments \n\nIP: ".$_SERVER['REMOTE_ADDR'];
I know this is a pretty old question, but I though about helping who arrives on this one.
First, I would recommand Contact form 7 plugin for creating a form with wordpress.
It could look like this at the creation of the form:
you add in the body of your message (in the screenshot in the right column "Message Body") the following short code :
[wpcf7.remote_ip]
Your message would (without modification) look like:
From: [your-name] <[your-email]> Subject: [your-subject]
Message Body: [your-message]
Sent from: [wpcf7.remote_ip]
--
This e-mail was sent from contact form on Testing (heep://localhost:8888/wordpress)
this will print the user IP into the email you'll receive.
Then in your post, you integrate the short code given into the page (like):
[contact-form-7 id="1056" title="Sample Form"]
I've git a problem with an registration script of my login.
This script handles the registration information of the user and saves them.
Additional an email is send to this person, in order to verify his emailaddress.
The problem is that this email is markes as a phishing email by thunderbird.
//send verify email
$sender = "test#example.de";
$empfaenger = $email;
$betreff = "Welcome";
$mailtext = "Thank you for your registration.
Please go to this site and enter your
activationcode in order to verify your email-address";
mail($empfaenger, $betreff, $mailtext, "From: $sender\n" . "Content-Type:
text/html; charset=iso-8859-1\n")
If I delete the link
<a> href=\"http://validatingsite.de\">this site</a>
the email is not marked and everything is okay.
Anybody an idea how to solve my problem?
Do I add the link correctly in the email?
That's Thunderbird behaving as designed: https://support.mozillamessaging.com/en-US/kb/thunderbirds-scam-detection#w_thunderbirds-automatic-scam-filtering
Note the first bullet in their list of items that will trip the phishing detection: links with numerical server names (http://127.0.0.1/)
I'm looking to create a form on my website where users can enter their email address and a message (however long). Then upon clicking on a submit button, the code, sends the message as an email to my mailbox.
I was wondering if someone knew what code i could use. I am using PHP as my server-side language.
You need to have access to an smtp server somewhere. Assuming you do, use the php mail function to send the mail like so:
$Name = "John doe"; //senders name
$email = "email#adress.com"; //senders e-mail adress
$recipient = "recipient#emailadress.com"; //recipient
$mail_body = "The text for the mail..."; //mail body
$subject = "Subject for receiver"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
mail($recipient, $subject, $mail_body, $header);
The smtp server is set in the php.ini file in these two lines:
SMTP = servername
smtp_port = 25
More information at w3schools site.
while the above two answers provide a basic email sending suggestion, there's one thing you should consider, the codes are not secure. spammers can inject Cc: codes and send spam using the form. if they do, your smtp provider may ban your account. try a dedicated mailer, like phpmailer
Try to use PHPForms. It is an ultimate web form builder that allows to create professionally looking email forms within just a few minutes. You will only need to create a PHP form by means of an intuitive interface and generate a code that can be easily copied and pasted to any web page.