Jump to content

email subject


dhatura1

Recommended Posts

I got some help and finally got the multiple recipients working correctly, but this leaves me with another problem. The "message sent" confirmation page now lists the "attn:" as array(array) and when i get the emails, the subject is "0"

 

here is my php code, and the address is sideshowsirens.com/contact.php, if you wanna check it out for yourself. The emails that go to me are webmaster.

 

 

$todayis = date("l, F j, Y, g:i a") ;

 

$attn = $attn ;

$subject = $attn ;

 

$notes = stripcslashes($notes);

 

$message = " $todayis [EST] \n

Attention: $attn \n

Message: $notes \n

From: $visitor ($visitormail)\n

Additional Info : IP = $ip \n

Browser Info: $httpagent \n

Referral : $httpref \n

";

 

$from = "From: $visitormail\r\n";

$mail_index = (int) $_POST['attn'];

 

$attn = array(

 

1 => "[email protected]",

0 => "[email protected]"

);

 

$to = $attn[$mail_index];

 

mail($to, $subject, $message, $from);

 

 

 

 

?>

 

<p align="center">

Date: <?php echo $todayis ?>

<br />

Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )

<br />

 

Attention: <?php echo $attn ?> ( <?php echo $attn ?> )

<br />

Message:<br />

<?php $notesout = str_replace("\r", "<br/>", $notes);

echo $notesout; ?>

<br />

<?php echo $ip ?>

 

<br /><br />

<a href="thankyou.html"> Next Page </a>

</p>

:confused:

Link to comment
https://forums.phpfreaks.com/topic/206910-email-subject/
Share on other sites

From the looks of it, you never define the subject in the first place, which is why it probably spits out a 0 so that it's not blank.

 

Your variable definition is confusing... but you initially list:

 

$attn = $attn ;

$subject = $attn ;

 

None of those have a value unless you defined $attn earlier in the code and didn't show it here.

 

In the body of the message, you can't just echo an array, you have to use a foreach statement to display the results however you want.

Link to comment
https://forums.phpfreaks.com/topic/206910-email-subject/#findComment-1082055
Share on other sites

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.