Sending form data to email - It's not working

  • cleartango
  • Newbie
  • Newbie
  • cleartango
  • Posts: 7

Post 3+ Months Ago

Hi Can anybody tell me what's wrong with the following...Am not receiving data by email

This is driving me nuts and it's causing me big problems, so would be very grateful if anyone can shed some light, help create a fix

Thanks

Mick

<?php_track_vars?>

<?php
$to = "email address";
$to2 = "email address";
$to3 = "email address";

$from = $_REQUEST['contactemail'] ;
$name = $_REQUEST['contactname'] ;
$headers = "From: $from";
$subject = "Request for Conference Places in York on Dec 10";

$fields = array();
$fields{'contactname'} = " Contact Name";
$fields{'contactemail'} = " Contact Email";
$fields{'contactphone'} = " Contact Phone";
$fields{'contactaddress'} = " Contact Address";
$fields{'organisation'} = " Organisation";
$fields{'delegate1name'} = "Del 1 NAME";
$fields{'delegate1job'} = "Del 1 JOB";
$fields{'delegate1email'} = " Del 1 EMAIL";
$fields{'delegate2name'} = "Del 2 NAME";
$fields{'delegate2job'} = "Del 2 JOB";
$fields{'delegate2email'} = " Del 2 EMAIL";
$fields{'delegate3name'} = "Del 3 NAME";
$fields{'delegate3job'} = "Del 3 JOB";
$fields{'delegate3email'} = " Del 3 EMAIL";
$fields{'delegate4name'} = "Del 4 NAME";
$fields{'delegate4job'} = "Del 4 JOB";
$fields{'delegate4email'} = " Del 4 EMAIL";
$fields{'delegate5name'} = "Del 5 NAME";
$fields{'delegate5job'} = "Del 5 JOB";
$fields{'delegate5email'} = " Del 5 EMAIL";
$fields{'delegate6name'} = "Del 6 NAME";
$fields{'delegate6job'} = "Del 6 JOB";
$fields{'delegate6email'} = " Del 6 EMAIL";
$fields{'delegate7name'} = "Del 7 NAME";
$fields{'delegate7job'} = "Del 7 JOB";
$fields{'delegate7email'} = " Del 7 EMAIL";
$fields{'delegate8name'} = "Del 8 NAME";
$fields{'delegate8job'} = "Del 8 JOB";
$fields{'delegate8email'} = " Del 8 EMAIL";
$fields{'delegate9name'} = "Del 9 NAME";
$fields{'delegate9job'} = "Del 9 JOB";
$fields{'delegate9email'} = " Del 9 EMAIL";
$fields{'delegate10name'} = "Del 10 NAME";
$fields{'delegate10job'} = "Del 10 JOB";
$fields{'delegate10email'} = " Del 10 EMAIL";
$fields{'payment'} = " Payment";
$fields{'terms'} = "Terms";


$body = "Request for Conference Places in York on Dec 10:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }

$headers2 = "From: email address";
$subject2 = "Managing the Economy in Yorkshire and Humber ";
$autoreply = "Thank you for your reservation for the 'Managing the Evening and Night-time Economy in Yorkshire and Humber' conference.

Your conference places will be confirmed once we have received your payment. Conference details and a conference preference questionnaire will be sent to you shortly.

If you do NOT receive a proforma within 24 hours or if you have any questions, please contact us on email address";

$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
$send3 = mail($to2, $subject, $body, $headers);
$send4 = mail($to3, $subject, $body, $headers);

if($payment=="bacs")
{header("Location: url"); exit(); }
elseif($payment=="card")
{header("Location: url"); exit(); }
else
{header("Location: url"); exit(); }

?>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • The_torst
  • Graduate
  • Graduate
  • The_torst
  • Posts: 216
  • Loc: Denmark

Post 3+ Months Ago

"PHP requires an installed and working email system" quote from: http://www.w3schools.com/PHP/php_ref_mail.asp

Have you looked at that? Before trying anything at all you should isolate the mail function. Just call it with strings: $send = mail("toaddress", "subject", "bodytext", "headers");

It's a lot better to troubleshoot that way, as even the simplest things can go wrong.
  • cleartango
  • Newbie
  • Newbie
  • cleartango
  • Posts: 7

Post 3+ Months Ago

Thanks The_torst.

Is the working mail system mail.ini something I need to keep in my directory or is it sthg my ISP will hold?

It now seems some of my mails are getting throu but is taking days to arrive. it also seems that mails only go to one of my four specified email addresses. Any idea why this is?

Will test with strings as you suggest.

Mick

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 51 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.