herghost Posted November 4, 2009 Share Posted November 4, 2009 Hi all, I have the below: <?php require_once "Mail.php"; $from = $_GET['email']; $to = "Contact <contact@stockluck.com.au>"; $subject = $_GET['subject']; $body = $_GET['message']; $name = $_GET['name']; $host = "ssl://mail.stockluck.com.au"; $port = "465"; $username = "mail+stockluck.com.au"; $password = "*******"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject, 'Name' => $name); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body, $name); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<br><br><p>Message successfully sent!<br>You will receive a reply within 24 hours, thank you for contacting Stockluck.com.au!</p>"); } ?><br> <br> <br> <center> <a href="../index.php" title="Cancel & close dialog" onclick="Modalbox.hide(); return false;">Close</a><br /> Which all works kinda! Basically I want to attach the $name variable to the $body so I know the name of the person sending the message, at the moment it does not appear anywhere on the sent email. Many Thanks Quote Link to comment Share on other sites More sharing options...
Bricktop Posted November 4, 2009 Share Posted November 4, 2009 Hi herghost, Assign a $message variable and then create a new $body variable with the required variables combined. For example: $from = $_GET['email']; $to = "Contact <contact@stockluck.com.au>"; $subject = $_GET['subject']; $message = $_GET['message']; $name = $_GET['name']; $body = "$name\n\n$message\n\n"; Hope this helps. Quote Link to comment Share on other sites More sharing options...
herghost Posted November 4, 2009 Author Share Posted November 4, 2009 Thanks, that works great Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.