mail()
Posted: Tue Jun 06, 2006 9:19 am
Hey,
I've done a php codw where people should get emailed from a database and i get this error:
Warning: mail() [function.mail]: SMTP server response: 501 Syntax error in parameters or arguments to MAIL command in D:\www\Apeal\mail\david\mail_send.php on line 59
Emailet skickades till 'david.wibergh@gmail.com'
Notice: Use of undefined constant subject - assumed 'subject' in D:\www\Apeal\mail\david\mail_send.php on line 59
And this is my code:
I've also looked up the SMTP replies and seen that error 501 means: 501 Syntax error in parameters or arguments
So i've looked if I made the correct mail form and i think i've done it. I've also looked on diffrent places but can't find why.
Thanks a lot and I hope i'm not doing any easy error that's just a waste of your time.
Thanks
I've done a php codw where people should get emailed from a database and i get this error:
Warning: mail() [function.mail]: SMTP server response: 501 Syntax error in parameters or arguments to MAIL command in D:\www\Apeal\mail\david\mail_send.php on line 59
Emailet skickades till 'david.wibergh@gmail.com'
Notice: Use of undefined constant subject - assumed 'subject' in D:\www\Apeal\mail\david\mail_send.php on line 59
And this is my code:
Code: Select all
<?php
session_start(); // Alltid överst på sidan
error_reporting(E_ALL);
// Kolla om inloggad = sessionen satt
if (!isset($_SESSION['sess_user'])){
echo "<script type='text/javascript'>
document.location.href = 'index.php';
</script>";
exit;
}
?>
<?php include '../meny.php'; ?>
<?php include '../meny_mail.php'; ?>
<?php
include "../conn.php";
#################
# VARIABLAR #
#################
$text = $_POST['meddelande'];
$subject = $_POST['subject'];
$sender = $_POST['sender'];
$user = $_POST['user'];
$datum = $_POST['datum'];
$tid = $_POST['tid'];
$NewReplyTo = $_POST['sender'];
$avser = 'skarpt';
$tabell_arkiv = "test_arkiv";
$tabell_epost = "test_mailadresser";
$message2 = "<a href=\"http://www.nippe.net/test/lindahl/briefings/tabort.php?id=22?databas={$tabell_epost}\">Vill du inte längre få detta nyhetsbrev. Klicka här</a>\r\n";
##################
# /VARIABLAR #
##################
if(($text == "") || ($subject == "") || ($sender == "")) {
echo "<script type='text/javascript'>
document.location.href = 'http://www.apeal.se/mail/mail_form.php';
</script>";
exit;
} else {
$epost = "select epost from $tabell_epost where aktiv='yes'";
$result = mysql_query($epost);
$rows = mysql_fetch_array($result);
// To send HTML mail, the Content-type header must be
$MailHeader = 'MIME-Version: 1.0' . "\r\n";
$MailHeader .= 'Content-type: text/html; charset=iso-8859-9' . "\r\n";
//fungerar inte $MailHeader .= 'bcc:' . "\r\n";
$MailHeader .= 'From: '. $sender. '<'. $sender . '>'. "\r\n";
$MailHeader .= 'Reply-To: '.$NewReplyTo.' <'.$NewReplyTo.'>'. "\r\n";
$MailHeader .= 'Date: '.date('r'). "\r\n";
$MailHeader .= 'Message-ID: <'.date('YmdHis').'info@'.$_SERVER['SERVER_NAME'].'>'. "\r\n";
$MailHeader .= 'X-Mailer: PHP/' . phpversion(). "\r\n";
$MailHeader .= 'X-Priority: 3' . "\r\n";
//$Mailheader .= 'Return-path: '. $sender. '<'. $sender . '>'. "\r\n";
$MailHeader .= 'Importance: Normal'."\r\n";
$message1 = "<a href=\"http://www.nippe.net/test/lindahl/briefings\">Kan du inte läsa detta nyhetsbrev. Klicka här</a><br>\r\n";
while ($row = mysql_fetch_array($result)) {
$email_adrr = $row['epost'];
mail($email_adrr, stripslashes($_POST[subject]), stripslashes($text), $MailHeader);
echo "Emailet skickades till '$email_adrr'";
}
}
?>So i've looked if I made the correct mail form and i think i've done it. I've also looked on diffrent places but can't find why.
Thanks a lot and I hope i'm not doing any easy error that's just a waste of your time.
Thanks