Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We use a hosting company for our website but we have our mail servers hosted by our isp with our website domain; @sample.net.

SMTP mail.isp.com

On the website we have a contact form which emails questions@sample.net after the user submits it.

Using the default setting:

SMTP localhost
sendmail_path /usr/sbin/sendmail -t -i

And custom settings:

 sendmail_from noreply@sample.net

I was able to successfully send the mail to external domains other than @sample.com. After looking into this I believe it is because the SMTP is localhost and not properly pointed at our ISP mail servers.

What value would I put in the SMTP if I have an external company hosting the site with our mail servers being hosted by our ISP?

share|improve this question

2 Answers 2

Apart from what @adamo said which is indeed probable, you could also try sending out mail using PEAR::Mail.

Here's some sample code from unixcraft you can try out.

<?php
include("Mail.php");
/* mail setup recipients, subject etc */
$recipients = "feedback@yourdot.com";
$headers["From"] = "user@somewhere.com";
$headers["To"] = "feedback@yourdot.com";
$headers["Subject"] = "User feedback";
$mailmsg = "Hello, This is a test.";
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "smtp.mycorp.com";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "smtpusername";
$smtpinfo["password"] = "smtpPassword";
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
/* Ok send mail */
$mail_object->send($recipients, $headers, $mailmsg);
?>

Another solution (in case you want ALL mail going through the remote mail server) is to configure SSMTP as your sendmail binary.

share|improve this answer

The problem is that your domain's MX servers (at your ISP) do not accept email sent from elsewhere (outside the ISP) that claims to be from you as legitimate. You have to contact your ISP's mail technical support (this is not a first level support request of the "my outlook is not working" style) and solve this.

I've blogged about a similar case here.

In your case the simple solution might be the ISP allowing your webhost to connect to smtp.sample.net and send mail from there.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.