Using a PHP form, get the page title or any other element in the sent e-mail
Question
I am using a PHP form which I add in a page as a shortcode. I would like the user that receives the e-mail to also receive some indicator of the page the form was in…Is it possible to somehow get the value of anything in the page where the shortcode is placed?
This is the form’s send email function which generates the email content:
function send_email() {
// generate content
$content = "From: ".$_POST['mk-name']."rnEmail: ".$_POST['mk-email'];
if(!empty($_POST['mk-company'])) {
$content .= "rnCompany: ".$_POST['mk-company'];
}
$content .= "rnrn".$_POST['mk-message'];
// generate headers
$headers = 'From: '.$_POST['mk-name'].' <'.$this->from.'>'."rnReply-To: " . $_POST['mk-email']."rn";
if(!empty($this->atts['cc'])) {
$headers .= 'Cc: '.$this->atts['cc']."rn";
}
if(!empty($this->atts['bcc'])) {
$headers .= 'Bcc: '.$this->atts['bcc']."rn";
}
// send email
wp_mail($this->to, $this->subject, $content, $headers);
}
0
forms, php
4 years
2019-11-05T16:00:31-05:00
2019-11-05T16:00:31-05:00 0 Answers
62 views
0
Leave an answer