sstangle73 Posted December 31, 2011 Share Posted December 31, 2011 What is the best way for sending email from PHP pages? I have two different cases, the first of single emails and then I also send bulk emails to many people at once, say 100. Obviously need to hide the email addresses from the other people. Looking for the best way to get it passed spam filters and delivered with headers that dont cause red flags. Also efficient is always preferred :] Quote Link to comment https://forums.phpfreaks.com/topic/254137-email/ Share on other sites More sharing options...
scootstah Posted December 31, 2011 Share Posted December 31, 2011 Use a service designed for this. Like http://www.benchmarkemail.com/ There's a bunch more but I can't think of the names right now. Basically these services take a lot of steps to ensure mail is delivered. You won't ever have to worry about being black-listed or getting through spam filters. Quote Link to comment https://forums.phpfreaks.com/topic/254137-email/#findComment-1302882 Share on other sites More sharing options...
sstangle73 Posted December 31, 2011 Author Share Posted December 31, 2011 I would like to do it through my site though. Many of the emails are just going to be registration conformation, but there are also emails to all the active registered people. Quote Link to comment https://forums.phpfreaks.com/topic/254137-email/#findComment-1302885 Share on other sites More sharing options...
scootstah Posted December 31, 2011 Share Posted December 31, 2011 Most of the services have API's. To answer your original question, just use a loop to send an email X amount of times. If you send a large amount of mail within a short period of time you run the risk of being marked as a spammer, so it's advised to break up large amounts of mail into smaller chunks and spaced out a little. Quote Link to comment https://forums.phpfreaks.com/topic/254137-email/#findComment-1302887 Share on other sites More sharing options...
sstangle73 Posted December 31, 2011 Author Share Posted December 31, 2011 would php mail() be the best route? Quote Link to comment https://forums.phpfreaks.com/topic/254137-email/#findComment-1302888 Share on other sites More sharing options...
sstangle73 Posted December 31, 2011 Author Share Posted December 31, 2011 i get this as the from on gmail [email protected] via SERVERHIDDEN.inmotionhosting.com when trying to use php's mail is there a way to avoid this? Quote Link to comment https://forums.phpfreaks.com/topic/254137-email/#findComment-1302889 Share on other sites More sharing options...
scootstah Posted December 31, 2011 Share Posted December 31, 2011 It will work. You could try PEAR::Mail if you want a little more capability. i get this as the from on gmail [email protected] via SERVERHIDDEN.inmotionhosting.com when trying to use php's mail is there a way to avoid this? You can use mail headers to change the from. Quote Link to comment https://forums.phpfreaks.com/topic/254137-email/#findComment-1302890 Share on other sites More sharing options...
sstangle73 Posted December 31, 2011 Author Share Posted December 31, 2011 What would the headers have to be? this is what im using: $to = $email; $subject = "Mad Dog Mania Email Validation"; $message = "Test"; $from = "Mad Dog Mania <[email protected]>"; $reply = "Steven Stangle <[email protected]>"; $headers = 'From: ' . $from . "\r\n"; $headers .= 'Reply-to: ' . $reply . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; @mail($email,$subject,$message,$headers); and i get these headers on gmail: from: Mad Dog Mania [email protected] via ****.inmotionhosting.com sender-time: Sent at 1:13 PM (GMT-05:00). Current time there: 1:19 PM. ✆ reply-to: Steven Stangle <[email protected]> to: [email protected] date: Sat, Dec 31, 2011 at 1:13 PM subject: Mad Dog Mania Email Validation mailed-by: ****.inmotionhosting.com Quote Link to comment https://forums.phpfreaks.com/topic/254137-email/#findComment-1302891 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.