Jump to content

sending form to multiple email addresses


seeoneomen

Recommended Posts

I am sending a form to multiple email addresses using the $header variable to cc a string of addresses. For some reason, when I enter one of the addresses, the form says there is an error. I can use other email addresses and it works fine. Im not sure what the problem is with this email address. And ofcourse it is the one person that needs to receive the forms the most. I tried even just putting the email address in the mailto line and whenever this email is used in the php, the form will not validate. If anyone can help.. it will be the best birthday gift ever.. its my birthday.. WOO WOO 26.

 

Also, are there any limits on the number of addresses you can cc?

 

Here is my variable code:

 

$EmailTo = '[email protected]';

$header = "cc: [email protected], [email protected]";

 

the email address that makes it crash is [email protected]

 

 

Link to comment
https://forums.phpfreaks.com/topic/63169-sending-form-to-multiple-email-addresses/
Share on other sites

  • 1 year later...

Hi, I have this and my two email addresses have been changed, but one is one of my domains and the Bcc is my (altered) comcast.net address:

 

<?php

//--------------------------Set these paramaters--------------------------

 

// Subject of email sent to you.

$subject = 'Results from Contact form';

 

// Your email address. This is where the form information will be sent.

$emailadd = '[email protected]';

 

$headers = "Bcc: [email protected]";

 

// Where to redirect after form is processed.

$url = '/thankyou.htm';

 

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.

$req = '0';

 

// --------------------------Do not edit below this line--------------------------

$text = "Results from form:\n\n";

$space = ' ';

$line = '

';

foreach ($_POST as $key => $value)

{

if ($req == '1')

{

if ($value == '')

{echo "$key is empty";die;}

}

$j = strlen($key);

if ($j >= 20)

{echo "Name of form element $key cannot be longer than 20 characters";die;}

$j = 20 - $j;

for ($i = 1; $i <= $j; $i++)

{$space .= ' ';}

$value = str_replace('\n', "$line", $value);

$conc = "{$key}:$space{$value}$line";

$text .= $conc;

$space = ' ';

}

mail($emailadd, $headers, $subject, $text, 'From: '.$emailadd.'');

echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';

 

I added the "$headers" at bottom and the "$header Bcc" at top area.

 

can anyone tell me why it doesn't work? or what it ought to look like in code?

 

thanks!

Archived

This topic is now archived and is closed to further replies.

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