Jump to content

Drding

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Drding's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It worked! Wow that was almost too easy to be true lol. Thanks JD, you're a life saver!
  2. Hello all! First, I'm a complete noob when it comes to php coding so bare with me on this. I know this might seem like a super simple thing to do, but as I said I'm a beginner at best. What I have is a very simple contact form with three fields: name, email, and comments. The way I have it set up is that when someone fills out the form and hits the submit button, it sends me an email via Gmail with the values of the form. Pretty basic stuff. The thing is, when I get the values in the email, it's all on one line and rather unflattering looking. It works for just me, I don't care really. But I'd like to turn around and use this form/php code I have for a client. The form for them is going to have a lot more input fields and I can only imagine the string of text that it's going to create. What I would like to do is format the values that I or they receive via email so that it's a bit more presentable. I have no idea how to do this. Here's my php code connected to my form: <?php include_once("phpmailer/class.phpmailer.php"); $name = $_POST['name']; $email = $_POST['email']; $comments = $_POST['comments']; $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->Host = "smtp.gmail.com"; $mail->SMTPSecure = "ssl"; $mail->Port = 465; $mail->Username = "myemail@gmail.com"; $mail->Password = "xxxxxx"; $mail->AddAddress("mymail@gmail.com"); $mail->From = "mymail@gmail.com"; $mail->FromName = $_POST['name']; $mail->Subject = "User Comment"; $mail->IsHTML(true); $mail->Body = "Name: $name\n Email: $email\n Comments: $comments"; if($mail->Send()) { echo "Message sent! Thanks for your comments!"; } ?> so right now with that I get an email for example that looks like this: Name: Bob Email: blank@blank.com Comments: I like soda! where I would rather have something like: Name: Bob Email: blank@blank.com Comments: I like soda! Any advice would very much appreciated!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.