Gayner Posted December 18, 2009 Share Posted December 18, 2009 $host = $_SERVER['HTTP_HOST']; $host_upper = strtoupper($host); $login_path = @ereg_replace('admin','',dirname($_SERVER['PHP_SELF'])); $path = rtrim($login_path, '/\\'); $message = "Thank you for registering with us. Your account has been activated... *****LOGIN LINK*****\n http://$host$path/login.php Thank You Administrator $host_upper ______________________________________________________ THIS IS AN AUTOMATED RESPONSE. ***DO NOT RESPOND TO THIS EMAIL**** "; @mail($to_email, "User Activation", $message, "From: \"Member Registration\" <auto-reply@$host>\r\n" . "X-Mailer: PHP/" . phpversion()); ok so it works but when i get my message its like this: It says MAILED BY-CP02.Stablehost.com I don't want to show MY SHARED HOSTING PROVIDEr.. LOL How do i FIX? Quote Link to comment https://forums.phpfreaks.com/topic/185564-php-mail-simple-request/ Share on other sites More sharing options...
oni-kun Posted December 18, 2009 Share Posted December 18, 2009 Gmail and anything that can read e-mail headers would see where it is coming from. If your e-mail is physically coming from your shared host's server, than that is what it'll show. You can ask your host to create an alias (so it shows mail.yourdomain.com) or register for another mail service.. Quote Link to comment https://forums.phpfreaks.com/topic/185564-php-mail-simple-request/#findComment-979689 Share on other sites More sharing options...
Gayner Posted December 18, 2009 Author Share Posted December 18, 2009 Gmail and anything that can read e-mail headers would see where it is coming from. If your e-mail is physically coming from your shared host's server, than that is what it'll show. You can ask your host to create an alias (so it shows mail.yourdomain.com) or register for another mail service.. a Alias just for my account ? Quote Link to comment https://forums.phpfreaks.com/topic/185564-php-mail-simple-request/#findComment-979690 Share on other sites More sharing options...
oni-kun Posted December 18, 2009 Share Posted December 18, 2009 Gmail and anything that can read e-mail headers would see where it is coming from. If your e-mail is physically coming from your shared host's server, than that is what it'll show. You can ask your host to create an alias (so it shows mail.yourdomain.com) or register for another mail service.. a Alias just for my account ? Ask them to set up an MX record for your domain, so you can 'send' messages from your smtp server. Quote Link to comment https://forums.phpfreaks.com/topic/185564-php-mail-simple-request/#findComment-979699 Share on other sites More sharing options...
PFMaBiSmAd Posted December 18, 2009 Share Posted December 18, 2009 Here is a more verbose explanation - Your hosting control panel should have a section called DNS zone record/editor... You need to create an A record for your domain, something like mail.yourdomain.com that points to the IP address of your host's actual mail server. You then need to create an MX record that points to mail.yourdomain.com This will make it appear that you have a mail server by the name mail.yourdomain.com You then send mail from your php script using mail.yourdomain.com as the SMTP hostname setting (use an ini_set() statement in your script.) This should cause mail sent by your script to appear as though it is coming from your 'own' mail server. Quote Link to comment https://forums.phpfreaks.com/topic/185564-php-mail-simple-request/#findComment-980209 Share on other sites More sharing options...
mrMarcus Posted December 18, 2009 Share Posted December 18, 2009 use optional 5th sendmail parameter: <?php $headers = "From: Member Registration <auto-reply@{$host}\r\n"; $headers .= "X-Mailer: PHP " . phpversion() . "\r\n"; if (mail($to_email, "User Activation", $message, $headers, "-fauto-reply@{$host}")) { echo 'Message Sent!'; } else { echo 'Message Not Sent.'; } ?> code assumes $host is a trusted domain on the server. do not suppress mail function .. simply handle it. Quote Link to comment https://forums.phpfreaks.com/topic/185564-php-mail-simple-request/#findComment-980221 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.