Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From address is same as sender address #36

Open
dannyboy opened this issue Jun 14, 2018 · 10 comments
Open

From address is same as sender address #36

dannyboy opened this issue Jun 14, 2018 · 10 comments

Comments

@dannyboy
Copy link

dannyboy commented Jun 14, 2018

Confused. Why is the from address set to the sender address?

Shouldn't this:

$header  .= 'From: =?UTF-8?B?' . base64_encode($this->sender) . '?= <' . $this->sender_email . '>' . PHP_EOL;
$header  .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->sender) . '?= <' . $this->sender_email . '>' . PHP_EOL;

be more like this:

$header  .= 'From: ' . $this->from . PHP_EOL;
$header  .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->sender) . '?= <' . $this->sender_email . '>' . PHP_EOL;

Sorry if i've missed something.

@BigBird420
Copy link

Hey this is my first time working with php and i'm trying to use it in a contact form page to send the website owner a email, i'm not sure what the issue is but it wont send the the the email doesn't get sent to the website owner if you can give any advice please let me know thanks 👍

@BigBird420
Copy link

I can send you my snippet later today if you need to see it

@aftoledo
Copy link

@BigBird420 What error have you received? If you haven't received like me, I just change the code like above and started to work.

@BigBird420
Copy link

@aftoledo there are no error messages the site seems to be running the php file fine but it doesn’t send a email to the owners email account

@aftoledo
Copy link

@BigBird420

If your problem is like mine, just change it:
$header .= 'From: =?UTF-8?B?' . base64_encode($this->sender) . '?= <' . $this->sender_email . '>' . PHP_EOL;
$header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->sender) . '?= <' . $this->sender_email . '>' . PHP_EOL;

to something like this:
$header .= 'From: ' . $this->from . PHP_EOL;
$header .= 'Reply-To: =?UTF-8?B?' . base64_encode($this->sender) . '?= <' . $this->sender_email . '>' . PHP_EOL;

@BigBird420
Copy link

@aftoledo when I get home I’ll share my snippet looks different from yours

@BigBird420
Copy link

@aftoledo <?php
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];

$email_form = '[email protected]';

$email_subject = "New Form Submission";

$email_body = "User Name: $name.\n".
				"User Email: $visitor_email.\n".
				 	"User Message: $message.\n";

$to = "[email protected]";

$headers = "form: $email_form \r\n";

$headers .= "Reply-To: $visitor_email \r\n";

mail($to,$email_subject,$email_body,$headers);

header("Location: index.html");

?>

@aftoledo
Copy link

aftoledo commented Sep 2, 2018

I don't know if it matters, but try to change single to double cotes here:
$email_form = '[email protected]';

@BigBird420
Copy link

hey it didnt end up working i just went back and restarted the form by using formspree and javascript thanks though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants