Mark Rummel
Mark Rummel

Reputation: 2940

Send email with PHP when domain is hosted by Media Temple and email is hosted by domains.live.com

I have setup a simple form on my website to test sending email using PHP.

The form posts the input of three text fields to email-form-process.php, which looks like this:

<?php

    $email = $_POST['email'];

    $subject = "Test Email Worked";

    $msg = $_POST['comment'];

    mail ('$email','$subject','$msg');

    header('Location: email-form-confirm.php');
    exit();

?>

I echoed out the three inputs in a test to make sure email-form-process.php is receiving them from the form, which it is.

The problem I am having is that the email isn't being received at any of my emails. I have tested it going to a @live.com email and to two custom domains hosted by domains.live.com.

I use domains.live.com to host all of my email for my websites. I have my DNS records setup via my host, MediaTemple, for domains.live.com to handle my email. This works really great for regular email stuff, but I'm not sure what the best way is to send email in PHP using my custom domain emails hosted by domains.live.com.

How do I send email from [email protected] via PHP when my domain is hosted by MediaTemple and my email is hosted by domains.live.com?

I have not tried using the SMTP method yet. Would the solution found at the following link be a good direction for me to go? http://www.9lessons.info/2009/10/send-mail-using-smtp-and-php.html

Thank you in advance for any help you can offer!

-Mark

Upvotes: 4

Views: 9432

Answers (3)

mt_Sara
mt_Sara

Reputation: 41

If you're hosting mail elsewhere, you'll need to disable local mail for your server.

http://kb.mediatemple.net/questions/519/How+to+enable+or+disable+local+mail+for+your+server%3F

Upvotes: 4

davidethell
davidethell

Reputation: 12018

You can use something like PHPMailer which will make it a LOT easier to use SMTP mail. That is definitely a better solution overall anyway than using the built in mail command in PHP as PHPMailer gives you much better attachment handling, recipient handling, etc. without having to write your own headers to send through the mail function.

You could also send from MediaTemple's server and just set the host name as your domain. It doesn't have to match the MX record although spam filters take notice of that and so you'll need to configure your domain for SenderID and SPF at the minimum so that the MediaTemple host is seen as a valid email sender for your domain.

Upvotes: 0

Eric Simons
Eric Simons

Reputation: 109

Because Live is hosting your email, it may be blocking/sending the incoming emails immediately to spam folder. Your web server has a different IP than live's email server, so it might think it is sending bogus emails.

You might also want to look into sendgrid; they put your server IP on a whitelist and your emails will DEFINITELY get through.

Hope this helps!

Upvotes: 0

Related Questions