Page 1 of 1

SendMail with SMTP

Posted: Fri Jan 22, 2010 8:46 am
by darkott
Hi I have problems with the sendmail component in wy web, after implementing SMTP auth this is not working and i have this message
Warning: mail() [function.mail]: SMTP server response: 550 Sender is not allowed:

<?php
ini_set('error_reporting',E_ALL);
ini_set('display_errors','On');

if(isset($_POST["submit"])){
// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "contact@company.com.mk";
$Subject = Trim(stripslashes($_POST['Subject']));
$From = Trim(stripslashes($_POST['From']));
$Message = Trim(stripslashes($_POST['Message']));

// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
$msg = "Please enter all fields!";
$status = "err";
}
else{
// prepare email body text
$Body = "";
$Body .= "From: ";
$Body .= $From;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
if ($success){
$msg = "Message sent successfully.";
$status = "success";
}
else{
$msg = "Error occured while sending message. Please try later.";
$status = "err";
}
}
}
What should i do to fix this problem?