Reply
Old 08-04-2004, 08:50 AM PHP-sendingmail
Junior Talker

Posts: 2
Trades: 0
Hi,
Here is my problem : I can receive the mail but the Cc does not work. Somebody has an idea where I have to make the modifications?
Thanks for your help.
Here is the code.

<?php

/*
* xxxx
*/


// get required base data
$contactTime = date('d.m.Y H:i:s',time());
$contactLang = strtoupper($_POST['lng']);
$contactClub = $_POST['club'];
$contactTitle = $_POST['title'];
$contactLastName = stripslashes($_POST['lastname']);
$contactFirstName = stripslashes($_POST['firstname']);
$contactAddress = stripslashes($_POST['address']);
$contactCity = stripslashes($_POST['city']);
$contactEmail = stripslashes($_POST['email']);
$contactDayPhone = stripslashes($_POST['dayphone']);
$contactNightPhone = stripslashes($_POST['nightphone']);

switch($contactClub)
{
case 'geneva' : $mailTo = 'x@x.com';
$clubName = 'Geneva';
break;
case 'lausanne' : $mailTo = 'x@x.com';
$clubName = 'Lausanne';
break;
case 'seepark' : $mailTo = 'x@x.com';
$clubName = 'Paris';
break;
case 'zurich' : $mailTo = 'x@x.com';
$clubName = 'Zürich';
break;
case 'citygreen' : $mailTo = 'x@x.com';
$clubName = 'London';
break;
}

$redirect = '../'.strtolower($contactLang).'/thanks.html';
$mailToName = 'Place';
$mailSubject = 'place 06/04';
$mailBody = "
<b>Place 06/04</b>
<br><br>
<table cellpadding='0' cellspacing='0' border='0'>
<tr>
<td width='200'>Langue</td>
<td width='30'>&nbsp;:&nbsp;</td>
<td>$contactLang</td>
</tr>
<tr>
<td width='200'>Date/heure d'envoi</td>
<td width='30'>&nbsp;:&nbsp;</td>
<td>$contactTime</td>
</tr>
<tr>
<td colspan='3'>&nbsp;</td>
</tr>
<tr>
<td>Club</td>
<td>&nbsp;:&nbsp;</td>
<td>$clubName</td>
</tr>
<tr>
<td colspan='3'>&nbsp;</td>
</tr>
<tr>
<td>Last name</td>
<td>&nbsp;:&nbsp;</td>
<td>$contactTitle</td>
</tr>
<tr>
<td>Last name</td>
<td>&nbsp;:&nbsp;</td>
<td>$contactLastName</td>
</tr>
<tr>
<td>First name</td>
<td>&nbsp;:&nbsp;</td>
<td>$contactFirstName</td>
</tr>
<tr>
<td>Address</td>
<td>&nbsp;:&nbsp;</td>
<td>$contactAddress</td>
</tr>
<tr>
<td>Zipcode / City</td>
<td>&nbsp;:&nbsp;</td>
<td>$contactCity</td>
</tr>
<tr>
<td>E-Mail</td>
<td>&nbsp;:&nbsp;</td>
<td><a href='mailto:$contactEmail'>$contactEmail</a></td>
</tr>
<tr>
<td>Day phone</td>
<td>&nbsp;:&nbsp;</td>
<td>$contactDayPhone</td>
</tr>
<tr>
<td>Night phone</td>
<td>&nbsp;:&nbsp;</td>
<td>$contactNightPhone</td>
</tr>
</table>
"; // end mailBody


/*
* don't touch anything from here to the end of file !
*/


// finalize mail
$htmlContent = "<html>
<head>
<title>$mailSubject</title>
</head>

<body>
$mailBody
</body>
</html>"; // end finalization

// mail headers
$headers = array(
"Subject" => "$mailSubject",
"Date" => date("D, d M Y H:i:s O"),
"From" => "$contactFirstName $contactLastName <$contactEmail>",
"To" => "$mailToName <$mailTo>",
"CC" => "<xx@x.com>",
"Content-Type" => "text/html; charset=iso-8859-1"
);

// mail socket
$debug = false;
$connect = fsockopen("smtp.x.fr", 25, $errno, $errstr, 30) or die("Could not talk to the sendmail server!");
$rcv = fgets($connect, 1024);
if($debug) print("<br>[$rcv]");
fputs($connect, "EHLO romuald.x.fr\r\n");
$rcv = fgets($connect, 1024);
if($debug) print("<br>[$rcv]");
fputs($connect, "MAIL FROM:<NOREPLY@x.com>\r\n");
$rcv = fgets($connect, 1024);
if($debug) print("<br>[$rcv]");
fputs($connect, "RCPT TO:<$mailTo>\r\n");
$rcv = fgets($connect, 1024);
if($debug) print("<br>[$rcv]");
fputs($connect, "RCPT CC:<xx@x.com>\r\n");
$rcv = fgets($connect, 1024);
if($debug) print("<br>[$rcv]");
fputs($connect, "DATA\r\n");
$rcv = fgets($connect, 1024);
if($debug) print("<br>[$rcv]");
$socketheaders = "";
foreach($headers as $key=>$value )
$socketheaders .= $key.": $value\r\n";
fputs($connect, $socketheaders);
$rcv = fgets($connect, 1024);
if($debug) print("<br>[$rcv]");
fputs($connect, "\r\n".str_replace("\n","",str_replace("\r\n","",$ htmlContent))."\r\n");
$rcv = fgets($connect, 1024);
if($debug) print("<br>[$rcv]");
fputs($connect, "\r\n\r\n.\r\n");
$rcv = fgets($connect, 1024);
if($debug) print("<br>[$rcv]");
fputs($connect, "RSET\r\n");
$rcv = fgets($connect, 1024);
if($debug) print("<br>[$rcv]");
fputs($connect, "QUIT\r\n");
$rcv = fgets($connect, 1024);
if($debug) print("<br>[$rcv]");

// redirect
header("Location: $redirect");


// end form.php

?>
santille is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 08-04-2004, 09:53 AM Messy
Novice Talker

Posts: 9
Location: Canada
Trades: 0
Can you atleast make your code less messy and comment your work if your going too ask for help. Its sad these days how no one comments .
__________________
Cory a.k.a owner of Avalon-Hosting!
avalon-hosting is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP-sendingmail
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.12139 seconds with 13 queries