Hello!
I have a problem in sending email. I have a script that sends an email to multiple recipients (above 100 recipients). I'm avoiding the use of bcc: or cc: field that's why I used a loop to send email using the To: field. But some of the emails were not sent. Is there an efficient way to solve this problem?
Many Thanks!
Some of the email not sent when specifying a many recipient.
Moderator: General Moderators
- aaronhall
- DevNet Resident
- Posts: 1040
- Joined: Tue Aug 13, 2002 5:10 pm
- Location: Back in Phoenix, missing the microbrews
- Contact:
Swiftmailer has some libraries to connect directly to the SMTP server to send email, which is far more efficient than mail() if your server allows for it.
- aaronhall
- DevNet Resident
- Posts: 1040
- Joined: Tue Aug 13, 2002 5:10 pm
- Location: Back in Phoenix, missing the microbrews
- Contact:
Well, if you're mailer class will connect directly to the SMTP server, give that a shot. Otherwise, you'd probably have better luck sending only a few at a time, by either setting up a cronjob or sleep()ing a few times over the course of the loop.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
PHPMailer used to just hang for me sometimes if I tried sending that many emails. Anyway, some (read, most) servers have limits on how many emails you can send in a single connection. You need to disconnect and reconnect before that limit is hit. SwiftMailer provides and anti-flood plugin for this but if you're srongly attached to PHPMailer it won't be too tricky to just track the number of emails sent in a loop. Have you checked for errors?
- jlising
- Forum Commoner
- Posts: 33
- Joined: Mon Mar 19, 2007 1:48 am
- Location: Pampanga, Philippines
- Contact:
Hello d11wtq!
I'm totally revising my scripts and I will use the Swift Mailer. I found out this class has the method name batchsend(), unfortunately, I cannot use this method because each message I will send to each recipient is customized (e. g. the salutation Dear Mr. Lising). That means, I need to go on with the looping statement to send emails.
Is there an easiest or very efficient way to do the same aside from what I think?
Thanks!
I'm totally revising my scripts and I will use the Swift Mailer. I found out this class has the method name batchsend(), unfortunately, I cannot use this method because each message I will send to each recipient is customized (e. g. the salutation Dear Mr. Lising). That means, I need to go on with the looping statement to send emails.
Is there an easiest or very efficient way to do the same aside from what I think?
Thanks!
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
How to customize messages for each recipient in a batchjlising wrote:Hello d11wtq!
I'm totally revising my scripts and I will use the Swift Mailer. I found out this class has the method name batchsend(), unfortunately, I cannot use this method because each message I will send to each recipient is customized (e. g. the salutation Dear Mr. Lising). That means, I need to go on with the looping statement to send emails.
Is there an easiest or very efficient way to do the same aside from what I think?
Thanks!