Jump to content

How do I Keep my sent emails & autoreplys from my mailform saved in a Log file


Duofilm

Recommended Posts

Hi,

This is currently my code that generates a mail to me with all info the user provided in the form on the site.

+ it sends a auto reply to the user with details in it.

I'd like to keep both emails stored in a log file for future use.

Is this possible ? is it hard to add ? I've got no clue

Anyone could help ?

 

 

<?php ob_start();

include_once('verbinding.php');

$result1 = mysql_fetch_array (mysql_query("SELECT COUNT(*) FROM `Clicks` WHERE Aan = '0'")); // controleren hoeveel rijen er zijn met "Aan" op 0
$lijst1 = $result1[0];
if($lijst1=='0') { // als de lijst leeg is wil dit zeggen dat ze allemaal op 1 staan en mogen ze gereset worden.
mysql_query("UPDATE `Clicks` SET `Aan`= '0' WHERE `Aan`='1'");
} // indien er ook maar 1 veld op 0 staat zal er direkt naar hier worden gesprongen

$result = mysql_fetch_array(mysql_query("SELECT ID,Email FROM `Clicks` WHERE Aan = '0' ORDER BY RAND() LIMIT 1"));
$naarwie = $result['Email'];
$ID = $result['ID'];
echo $ID;
echo $naarwie;

mysql_query("UPDATE `Clicks` SET `Aan`= '1' WHERE ID = '$ID'");



mysql_close($verbinding);          // Sluit de verbinding.
                                //   We hebben hem nu niet meer nodig. 


$fromemail="No-Reply <ikwerkthuis.be>"; // change here if you want
$toemail=$naarwie;   // change here if you want
$sub="Online info aanvraag";          // change here if you want
$success_page_name="bedankt.html";
////// do not change in following
if($_SERVER['REQUEST_METHOD']=="POST")
{
$fieldnm_1=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_1']));  
$fieldnm_2=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_2']));  
$fieldnm_3=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_3']));  
$fieldnm_4=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_4']));  
$fieldnm_5=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_5']));  
$fieldnm_6=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_6']));  


$contentmsg=stripslashes("<br><b><font style=color:#CC3300>$sub</font></b><br>
<table width=708 border=0 cellpadding=2 cellspacing=1 bgcolor=#CCCCCC>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Voornaam *:</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_1</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Achternaam *:</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_2</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>E-mail *:</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_3</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Telefoon *:</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_4</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Werkstatus *:</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_5</td>
</tr>

<tr>
      <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Leeftijd *:</b> </td>
      <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_6</td>
</tr>

</table>
");

////
$headers  = "MIME-Version: 1.0
";
$headers .= "Content-type: text/html; charset=iso-8859-1
";

$from=$fromemail;

$headers .= "From: ".$from." 
";

@mail($toemail,$sub,$contentmsg,$headers);


        $IP = $_SERVER['REMOTE_ADDR'];
        $DATE = date("Y-m-d");
        $TIME = date("H:i:s");
	$NameOfSender = $fieldnm_1;
	$SurnameOfSender = $fieldnm_2;
	//$emailadd = $naarwie;
$headers2  = "MIME-Version: 1.0
";
$headers2 .= "Content-type: text/html; charset=iso-8859-1
";

$from=$naarwie;

$headers2 .= "From: ".$from." 
";


$email = $fieldnm_3; // use their addy instead of yours
$subject = 'ikwerkthuis.be inloggegevens introductie film'; // change subject
$text = 'Beste  '. $NameOfSender .' '. $SurnameOfSender .',<br>
<br>
Welkom bij <A HREF="ikwerkthuis.be" TABINDEX="4">ikwerkthuis.be</A>.<br>
Hieronder vind U de logingevens voor het bekijken van de introductiefilm:<br>
<br>
Adres:            <A HREF="http://ikwerkthuis.be/index.php/introductie" TABINDEX="4">http://ikwerkthuis.be/index.php/introductie</A><br>
Gebruikersnaam:   introductie<br>
Paswoord:         film2012<br>
<br>
'. $contentmsg .'<br>
<br>
Wij nemen spoedig contact met u op.<br>
<br>
Met vriendelijke groeten,<br>
Het ikwerkthuis.be team<br>
<br>
IP: '. $IP .'<br>
Date: '. $DATE .'<br>
Time: '. $TIME .''; // change text

mail($email, $subject, $text,$headers2); // send another one out

header("Location:$success_page_name");

}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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