Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 02-24-2008, 01:21 PM Mass E-mail
Galaxian's Avatar
Rich Powell

Posts: 842
Name: Rich Powell
Location: United Kingdom
Trades: 0
Since mail(); isn't very good for a [highly] mass-email, does anyone have any recommended code for emailing a high number of emails?

Also a side question, what can I do if it goes to their Junk email? Anything I can set etc?

Thanks.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please help get the new
Please login or register to view this content. Registration is FREE
forum started for Webmasters like you!


Last edited by Galaxian; 02-24-2008 at 01:22 PM..
Galaxian is offline
Reply With Quote
View Public Profile Visit Galaxian's homepage!
 
 
Register now for full access!
Old 02-24-2008, 10:33 PM Re: Mass E-mail
Super Talker

Posts: 130
Trades: 0
I usually run mass mail code through command line. This takes care of any apache timeout limits and you can configure php on the page to ignore it's timeout using ini_set.
__________________
flann

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
flann is offline
Reply With Quote
View Public Profile
 
Old 02-24-2008, 10:56 PM Re: Mass E-mail
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
Quote:
Originally Posted by Galaxian View Post

Also a side question, what can I do if it goes to their Junk email? Anything I can set etc?
Put "Please, please go the the inbox" at the top of the email.
joder is offline
Reply With Quote
View Public Profile
 
Old 02-24-2008, 11:53 PM Re: Mass E-mail
Galaxian's Avatar
Rich Powell

Posts: 842
Name: Rich Powell
Location: United Kingdom
Trades: 0
Quote:
Originally Posted by flann View Post
I usually run mass mail code through command line. This takes care of any apache timeout limits and you can configure php on the page to ignore it's timeout using ini_set.
Thanks, however I'm more looking for directions with PHP code that is an alternative to mail() which seems to open and close the port for each mail sent.

Quote:
Originally Posted by joder View Post
Put "Please, please go the the inbox" at the top of the email.
Fun.

Any help anyone?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please help get the new
Please login or register to view this content. Registration is FREE
forum started for Webmasters like you!

Galaxian is offline
Reply With Quote
View Public Profile Visit Galaxian's homepage!
 
Old 02-25-2008, 01:50 AM Re: Mass E-mail
Arenlor's Avatar
Ultra Talker

Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
I did some research and found this, I take no credit for it, it's on the php site for fsockopen by a guy iain at monitormedia dot co dot uk.
http://www.php.net/manual/en/function.fsockopen.php it's down near the bottom.
PHP Code:
<? 

function another_mail($to,$subject,$headers,$message

 
// Could get this from the php ini? 
 
$from="me@here.com"
 list(
$me,$mydomain) = split("@",$from); 

 
// Now look up the mail exchangers for the recipient 
 
list($user,$domain) = split("@",$to,2); 
 if(
getmxrr($domain,$mx,$weight) == 0)  return FALSE

 
// Try them in order of lowest weight first 
 
array_multisort($mx,$weight); 
 
$success=0

 foreach(
$mx as $host) { 
  
// Open an SMTP connection 
  
$connection fsockopen ($host25, &$errno, &$errstr1); 
  if (!
$connection
    continue; 
  
$res=fgets($connection,256); 
  if(
substr($res,0,3) != "220") break; 

  
// Introduce ourselves 
  
fputs($connection"HELO $mydomain\n"); 
  
$res=fgets($connection,256); 
  if(
substr($res,0,3) != "250") break; 

  
// Envelope from 
  
fputs($connection"MAIL FROM: $from\n"); 
  
$res=fgets($connection,256); 
  if(
substr($res,0,3) != "250") break; 

  
// Envelope to 
  
fputs($connection"RCPT TO: $to\n"); 
  
$res=fgets($connection,256); 
  if(
substr($res,0,3) != "250") break; 

  
// The message 
  
fputs($connection"DATA\n"); 
  
$res=fgets($connection,256); 
  if(
substr($res,0,3) != "354") break; 

  
// Send To:, From:, Subject:, other headers, blank line, message, and finish 
  // with a period on its own line. 
  
fputs($connection"To: $to\nFrom: $from\nSubject: $subject\n$headers\n\n$message\n.\n"); 
  
$res=fgets($connection,256); 
  if(
substr($res,0,3) != "250") break; 

  
// Say bye bye 
  
fputs($connection,"QUIT\n"); 
  
$res=fgets($connection,256); 
  if(
substr($res,0,3) != "221") break; 

  
// It worked! So break out of the loop which tries all the mail exchangers. 
  
$success=1
  break; 
 } 
 
// Debug for if we fall over - uncomment as desired 
 // print $success?"Mail sent":"Failure: $res\n"; 
 
if($connection) { 
  if(
$success==0fputs($connection"QUIT\n"); 
  
fclose ($connection); 
 } 
 return 
$success?TRUE:FALSE


another_mail("recipient@some.domain","My Subject","X-mailer: PHP Script\nX-another-header: Whatever","Test email body.\n\nNote if you actually put a period on a line\nby itself, the function will terminate prematurely.\n\nYou will get a partial email sent though.\n"); 
?>
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 02-25-2008, 07:31 PM Re: Mass E-mail
Galaxian's Avatar
Rich Powell

Posts: 842
Name: Rich Powell
Location: United Kingdom
Trades: 0
Thank you, I will test this.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Please help get the new
Please login or register to view this content. Registration is FREE
forum started for Webmasters like you!

Galaxian is offline
Reply With Quote
View Public Profile Visit Galaxian's homepage!
 
Old 02-25-2008, 08:43 PM Re: Mass E-mail
Average Talker

Posts: 26
Name: Carl
Trades: 0
If you know shell programming you could throw together a quick script that reads a file which is the list of email addresses.
__________________

Please login or register to view this content. Registration is FREE
carlg is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Mass E-mail
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.33082 seconds with 12 queries