Chi Kien Uong
Geranienstraße 30
71034 Böblingen
Deutschland / Germany
|
If you are not registered or logged in, you may still use these forums but with limited features.
Show recent topics
|
|
|
Author |
Message |
|
I've a working mailform.php on my website:
<?php
/* * * * * * * * * * * * * * SEND EMAIL FUNCTIONS * * * * * * * * * * * * * */
function authmailform($action, $email, $fname, $lname, $cname, $telno, $comments)
{
//SMTP + SERVER DETAILS
/* * * * CONFIGURATION START * * * */
$smtpServer = "mail.mywebsite.nl";
$port = "25";
$timeout = "30";
$username = "mail@mywebsite.nl";
$password = "xxxxxxxxx";
$localhost = "localhost";
$newLine = "\r\n";
/* * * * CONFIGURATION END * * * * */
//Connect to the host on the specified port
$smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout);
$smtpResponse = fgets($smtpConnect, 515);
if(empty($smtpConnect))
{
$output = "Failed to connect: $smtpResponse";
return $output;
}
else
{
$logArray['connection'] = "Connected: $smtpResponse";
}
//Request Auth Login
fputs($smtpConnect,"AUTH LOGIN" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['authrequest'] = "$smtpResponse";
//Send username
fputs($smtpConnect, base64_encode($username) . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['authusername'] = "$smtpResponse";
//Send password
fputs($smtpConnect, base64_encode($password) . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['authpassword'] = "$smtpResponse";
//Say Hello to SMTP
fputs($smtpConnect, "HELO $localhost" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['heloresponse'] = "$smtpResponse";
//Email From
fputs($smtpConnect, "MAIL FROM: $email" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['mailfromresponse'] = "$smtpResponse";
//Email To
fputs($smtpConnect, "RCPT TO: $email" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['mailtoresponse'] = "$smtpResponse";
//The Email
fputs($smtpConnect, "DATA" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['data1response'] = "$smtpResponse";
//Construct Headers
$headers = "Content-type: text/plain".$newLine;
//$headers = "MIME-Version: 1.0" . $newLine;
//$headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine;
$headers .= "To: $lname <$email>" . $newLine;
$headers .= "From: $lname <$email>" . $newLine;
//fputs($smtpConnect, "To: $to\nFrom: $from\nSubject: $subject\n$headers\n\n$message\n.\n"); unix
fputs($smtpConnect, "To: $email".$newLine."From: $email".$newLine."Subject: $telno".$newLine."$headers".$newLine.$newLine."$comment".$newLine.".".$newLine); // windows
$smtpResponse = fgets($smtpConnect, 515);
$logArray['data2response'] = "$smtpResponse";
// Say Bye to SMTP
fputs($smtpConnect,"QUIT" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['quitresponse'] = "$smtpResponse";
return TRUE;
//print_r($logArray);
}
//pas de onderstaande variabelen aan naar jouw wensen
$adminaddress = "mail@mywebsite.nl";
$siteaddress ="http://www.mywebsite.nl";
$sitename = "mywebsite.nl";
//hieronder hoeft in principe niets ge-edit te worden...
// Haalt de tijd en de datum van de server
$date = date("m/d/Y H:i:s");
// Haalt de informatie dat gepost is door Flash
$action = $HTTP_POST_VARS['action'] ;
$email = $HTTP_POST_VARS['email'] ;
$fname = $HTTP_POST_VARS['fname'] ;
$lname = $HTTP_POST_VARS['lname'] ;
$cname = $HTTP_POST_VARS['cname'] ;
$telno = $HTTP_POST_VARS['telno'] ;
$comments = $HTTP_POST_VARS['comments'] ;
//De informatie uit de tekstbalken (de variabelen) wordt gestructureerd naar jouw email adres gestuurd.
if ($action == "send") {
//hieronder kan de tekst worden aangepast
//een harde enter wordt weergegeven als /n
//alles na een $-teken is een variabele
mail ("$adminaddress","Info Request",
"Een bezoeker van $sitename heeft het volgende bericht achtergelaten\n
Voornaam: $fname
Achternaam: $lname
Email: $email
Bedrijf: $cname
Telefoon: $telno\n
Bericht van $fname $lname:
______________________________
$comments
______________________________
Date/Time: $date","FROM:$adminaddress" ) ;
//De verzender van de email krijgt automatisch een bedankje
//deze tekst is ook aan te passen.
mail ("$email","Dank u voor het bezoeken van $sitename",
"Geachte heer/mevrouw $lname,\n
Dank u voor uw interesse in $sitename.\n
Uw mail wordt zo snel mogelijk in behandeling genomen.\n
\n
Met vriendelijke groet,\n
mywebsite
","FROM:$adminaddress"
) ;
//Deze bevestiging wordt naar Flash gestuurd als alles is afgerond.
$sendresult = "Dank u wel. U ontvangt binnen enkele seconden een bevestigingsmail.";
$send_answer = "answer=";
$send_answer = rawurlencode($sendresult);
echo $send_answer;
}
?>
Can I use this? Where do I place this file/code?
|
|
|
Thank you for your reaction but what do I have to ask my host? Other programs from my website are running fine with SMTP mailfucntion, why not Advanced Guestbook?
|
|
|
I'm very pleased with the possibilities of Advanced Buestbook 2.4.3. The only problem I've is the e-mail function.
My website is hosted on a Windowsserver with SMTP mailfunction. I've already removed .htaccess but the mailfunction is not operating at all. Other functions (upload, message display etc) is working fine.
|
|
|
|
|
|
Based on the open source JForum
|