Hi guys,
god it's been 5 years since I was last on here but I'm glad to see I can still hopefully get some help.
got a client who we have popped on a dedicated server using cpanel/whm etc.
We normally use their virtual hosting and the other 100+ accounts work fine using the php mail() function.
the problem is :
on the dedicated server mail() will only send mail to an email on the same domain, i.e the contact form works if you send it to info@mydomain.com but if I want to send out a thankyou email to the user it fails as the email address isnt on the same server?
so after 3 hours of screwing around online I ended up downloading PHPMailer and messing with the config.
I thought it might be an issue with not using SMTP and authentication too so I added that (not sure about using PEAR though b4 u ask) but that only works in the same way, I can send to the test email account on the same domain but not to an external email address.
Could it be an mx relay record issue and if so what do I need to do?
Could it be a WHM configuration setting ?
Can I do anything in cpanel to unlock the use of the mail.mydomain.co.uk usage?
Heres my code to use PHPMailer and SMTP :
require("phpmailer/phpmailer.inc.php");
$mail = new phpmailer;
$mail->IsSMTP(); // set mailer to use SMTP
$mail->AddAddress("me@mydomain.net", "test name");
$mail->AddReplyTo("noreply@sitedomain.co.uk", "Admin");
//$mail->AddAttachment("c:\\temp\\js-bak.sql"); // add attachments
//$mail->AddAttachment("c:/temp/11-10-00.zip");
$mail->From = 'noreply@sitedomain.co.uk';
$mail->FromName = 'Tester mail name';
$mail->Host = 'mail.sitedomain.co.uk';
$mail->Mailer = 'smtp';
$mail->Password = 'mypassword';
$mail->Username = 'noreply@sitedomain.co.uk';
$mail->Subject = $mail_subject;
$mail->SMTPAuth = "true";
$mail->Body = $mail_content;
if (!$mail->Send()) {
echo "<p>There was an error in sending mail, please try again at a later time</p>";
echo "<p>".$mail->ErrorInfo."</p>";
} else {
echo "<p>Thanks for your feedback, <em>$name</em>! We will contact you soon!</p>";
}
hope you guys can help as my hosting company simply "Do not offer support for scripts or configuration, only hardware issues".
Thanks guys :p