Giter Site home page Giter Site logo

Comments (10)

BigBird420 avatar BigBird420 commented on June 6, 2024

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 👍

from simple-php-contact-form.

BigBird420 avatar BigBird420 commented on June 6, 2024

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

from simple-php-contact-form.

aftoledo avatar aftoledo commented on June 6, 2024

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

from simple-php-contact-form.

BigBird420 avatar BigBird420 commented on June 6, 2024

@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

from simple-php-contact-form.

aftoledo avatar aftoledo commented on June 6, 2024

@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;

from simple-php-contact-form.

BigBird420 avatar BigBird420 commented on June 6, 2024

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

from simple-php-contact-form.

BigBird420 avatar BigBird420 commented on June 6, 2024

@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");

?>

from simple-php-contact-form.

aftoledo avatar aftoledo commented on June 6, 2024

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

from simple-php-contact-form.

aftoledo avatar aftoledo commented on June 6, 2024

double and single quotes: https://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php

from simple-php-contact-form.

BigBird420 avatar BigBird420 commented on June 6, 2024

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

from simple-php-contact-form.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.