Jump to content

on my email script


nouse4one

Recommended Posts

I am experiencing compleate brain failure here please help if you can.

 

This is my email script, how do i include multiple input, into the $body tag? example: vieweremail + comments + phonenumber + alot other stuff??

 

As of now i can only make it include 1 user input field thats is 'vieweremail'.

<?php
$to = $_POST['email_addy'];
$subject = "RE: your dating app";
$body = $_POST['vieweremail'];
if (mail($to, $subject, $body)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }
?>

Link to comment
Share on other sites

<?php
$to = $_POST['email_addy'];
$subject = "RE: your dating app";
$body = $_POST['vieweremail'];
$body .= $_POST['viewername'];

echo $body;
if (mail($to, $subject, $body)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }
?>

That is a big no go. I have over 30 fields i want to be included in my email body, can you give me a example im not getting it.

Link to comment
Share on other sites

That is a big no go. I have over 30 fields i want to be included in my email body, can you give me a example im not getting it.

 

Thats the exact way ist's supposed to work, so echo your POST values to see that things are being populated correctly.

 

What echoes for $body?

 

And try taking it out of the if statement to see if it works without it

Link to comment
Share on other sites

Yes im only writing stuff into the body of the email message

<?php
$to = $_POST['email_addy'];
$subject = "RE: your dating app";
$body = $_POST['vieweremail'];
$body .= $_POST['viewername'];
$body .= " ";
$body .= $_POST['areacode'];
$body .= " ";
$body .= $_POST['phone2'];
$body .= " ";
$body .= $_POST['phone3'];
$body .= " ";
$body .= $_POST['viewercomments'];
$body .= " ";
$body .= $_POST['q1'];
$body .= " ";
$body .= $_POST['q2'];
$body .= " ";
$body .= $_POST['q3'];
$body .= " ";
$body .= $_POST['q4'];
$body .= " ";
$body .= $_POST['q5'];
$body .= " ";
$body .= $_POST['q6'];
$body .= " "; 
$body .= $_POST['q7'];
$body .= " ";
$body .= $_POST['q8'];
$body .= " ";
$body .= $_POST['q9'];
$body .= " ";
$body .= $_POST['q10'];
$body .= " ";
$body .= $_POST['q11'];
$body .= " ";
$body .= $_POST['q12'];
$body .= " ";
$body .= $_POST['q13'];
$body .= " ";
$body .= $_POST['q14'];
$body .= " ";
$body .= $_POST['q15'];
$body .= " ";
$body .= $_POST['q16'];
$body .= " ";
$body .= $_POST['q17'];
$body .= " ";
$body .= $_POST['q18'];
$body .= " ";
$body .= $_POST['q19'];
$body .= " ";
$body .= $_POST['q20'];


if (mail($to, $subject, $body)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }
?>

this works buts is there a better way?

Link to comment
Share on other sites

I guess there a billion ways to do it, when I'm at work I create a table in HTML with all the data filled in, then add the table to the $body variable, so when the reader gets the mail it looks nice,

 

really you have to think about how you want it to look and then format it that way. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.