Php mail

software development

#1

This code works fine on other web hosts. Someone please let me know what I need to change to make it work with Dreamhost.

(Regarding my account, the account I am currently using only has an Affiliate account, but I manage a number of websites hosted on Dreamhost for clients - clients I actually referred to Dreamhost)

Here is my code. I know there are ways to make this safer but, most importantly, I need it work. Thanks.

[php]
$name = $_POST[‘name’];
$email = $_POST[‘email’];
$phone = $_POST[‘phone’];
$message = $_POST[‘message’];
$subject = $_POST[‘subject’];
$formcontent=“Sent from AnyelleBellydance.com.\n\nName: $name\nE-mail: $email\nPhone: $phone\n\nMessage:\n$message”;
$recipient = "justin.woodum@gmail.com";
$subject_full = “AnyelleBellydance.com: $subject”;
$mailheader = “From: $email \r\n”;
mail($recipient, $subject_full, $formcontent, $mailheader) or die(“Error!”);
echo “<meta http-equiv=“refresh” content=“0;url=…/ThankYou.html”>”;
[/php]


#2

Set the “From:” header to a single email address associated with the site that’s sending the message, not the user’s email address. If you need to have replies go to the email address the user entered, use the “Reply-To:” header for that.


#3

I had similar mail functions working find and now it seems that I’m also no longer getting mail through. I even put a small test script:

<?php $to = "mygmailaccount@gmail.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?>

And I get nothing now.


#4

Is the example.com email your domain that you’re sending from?

$from = "someonelse@example.com";

#5

I was just told that DH no longer allows any relaying from unauthenticated email addresses. My domain (oldsmobilecentral.com) and its email address that I set to the $from is hosted by google. With that being said, is there anyway I can get my webforms to send out successfully from any email address?

If I have to go through authentication, should I be able to use the information here with my oldsmobilecentral / gmail credentials?

http://www.websource99.com/2011/10/09/how-to-send-email-in-php-using-free-google-or-gmail-smtp-server/


#6

Yes, that indeed would be what’s going on :frowning: If your domain was hosted here, and just the email was with gmail, it would work.

I believe you can do that with phpMailer: http://wiki.dreamhost.com/PHPMailer


#7

I was really hoping for a quick basic way, but when I get time I’ll go ahead and try to implement everything with phpMailer. Hopefully things run smoothly.


#8

I was able to use phpmailer with my gmail account without any issues. Thanks


#9

Good to know! Whew. :smiley: