Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

phpmailer

Posted on 2010-09-16
6
Medium Priority
?
1,428 Views
Last Modified: 2013-12-17
Hi,
I am using PHPmailer to send emails from my server.
I have two questions:

1. I notices that when I send Emil, I doesn't get back till it sends it.
   Is there a way that I can send it asynchronous (so I don't need to wait).?
   If not, is there a 'php queue' that I can send 'tasks' to be executed asynchronous .

2. I will use it for many users. Is there a problem with it? or do I need to create a special queue for it?
0
Comment
Question by:VapiSoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 18

Expert Comment

by:Mark Gilbert
ID: 33691983
As you say you are dealing with a large number of messages I would setup a dedicated SMTP server and have phpmailer direct all the mail to that server. That way the class should work alot faster as it's passing off the job rather than handling the whole delivery itself and then in the SMTP configuration you can then set it up to process outbound mail in batches. Perhaps set it to send every 5 minutes.

That's the best recommendation I can make. Other than that you may be able to also route through to an external SMTP server.

Hope this helps.
0
 

Author Comment

by:VapiSoft
ID: 33692085
Currently I cannot dedicate an external server (I start very small).
How do I configure the SMTP to process it out bound.
I don't want to send every xxx, I just want to send it asynchronous so I don't need to wait (in the process that called it).
0
 
LVL 18

Accepted Solution

by:
Mark Gilbert earned 2000 total points
ID: 33692305
As it's slow, leads me to believe that there's a problem somewhere. Are you on a shared host? If so the default php mail function which phpmailer uses if no smtp is defined may be bogged down or overloaded. If the mail function has been routed to an smtp server on the host then that smtp may also be bogged down or may have something setup which is causing you latency. If it's a machine you have complete control over, is it possible that you are on a busy network? Mail shouldn't take long at all however if your process ntains many checks or functions then that may also be the cause of the slowdown. Without seeing your code specifically I am unable to determine the root cause.

If you did route your mail to an smtp server to batch process, you are alleviating the php processes to simply hand off the mail for processing via the smtp rather than have php do all the hard work to make sure it's sent before refreshing the page.

Another alternative would be to save the results of what you want to send via email to a database and have a separate process to go through those records and email them.
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 

Author Comment

by:VapiSoft
ID: 33692419
The problem is not that it slow (now).
I just wanted to be prepared when there are many users.
The current configuration that I am testing it in my WAMP (simulation for Appachi in Windows) and defined the SMPT server as my server which is located in another location.
There was a problem with the communication and I noticed that my task was hanged till the communication was back again. But now I think that it will not happen in a real network.
0
 
LVL 18

Expert Comment

by:Mark Gilbert
ID: 33692468
Thanks for accepting my answer. I'm glad I was able to help.

As a sidenote and follow up to your latest comment, don't assume that you won't have network issues at a later stage. For this reason it's probably a good idea to perhaps queue the messages in a database table and have a separate php process to go through those records and send out the emails. By separating the retrieval from a customer, with actually sending an email with that content you are ensuring that their process isn't hindered by any possible delays that the script may have contacting the smtp server, php mail functions, etc. Then if there are any delays you could have an alert sent to you stating that there's a problem with the mail queue which you could then intercept and redirect to another server if need be.

Hope this helps.
0
 

Author Comment

by:VapiSoft
ID: 33692507
Thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article outlines some of the reasons why an email message gets flagged as spam on a recipient's end.
We aren’t perfect, just like everyone else.  Check out the email errors our community caught and learn the top errors every email marketer should avoid.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question