Hi
I'm building a 'job posting' site of sorts.
When a job is available in a particular state, I want the system to send an
email to everyone who is 'watching' that state.
I know how to do this, but I need to figure out a way to 'send the emails
in the background' - ie: if an administrator adds a job to Wyoming, I don't
want them to have to wait for the php script to finish selecting and e-
mailing everyone watching the state before the administrator can move on
and do other things.
I originally thought that passing this task to the PHP command line would
do the trick, but it turns out that a script like...
exec("my php script that emails people");
echo "complete!" ;
....does not echo "complete!" until the thousands of people have all had
their info passed to the mail server (a long time).
I suppose that I could get rid of this by just lumping everyone together in
the Bcc: field of a single e-mail message, but at this point I'd like to
keep that as a last resort and go with the personalization ("Hi James... a
job has been posted in Wyoming").
Does anyone have any thoughts as to how I can send the emails without
preventing the administrator from doing other tasks until the script has
finished executing? 8 6518
*** Good Man wrote/escribió (Thu, 23 Jun 2005 00:03:14 -0500): Does anyone have any thoughts as to how I can send the emails without preventing the administrator from doing other tasks until the script has finished executing?
Do you have access to a crontab facility? Writing a shell script* that
sends needed mails and configuring it to execute at regular intervals can
be a good option.
(*) Shell scripts can be written in PHP too.
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Good Man <he***@letsgo.c om> wrote:
[snip] exec("my php script that emails people"); echo "complete!" ;
...does not echo "complete!" until the thousands of people have all had their info passed to the mail server (a long time).
[snip] Does anyone have any thoughts as to how I can send the emails without preventing the administrator from doing other tasks until the script has finished executing?
[snip]
You need to fork and background that process (see http://nl2.php.net/manual/en/function.pcntl-fork.php or simply append a
'&' to the program/script you exec (making sure _any_ output is
redirected to eg /dev/null)).
Better yet would be to create a que mechanism, add email and body to a
database and have a script periodically check if there are entries to be
sent. That way there is only 1 process trying to spam^Wsend email you
have to look after.
Alvaro G Vicario <al************ ******@telecomp uteronline.com> wrote in
news:zd******** *************** *****@40tude.ne t: *** Good Man wrote/escribió (Thu, 23 Jun 2005 00:03:14 -0500): Does anyone have any thoughts as to how I can send the emails without preventing the administrator from doing other tasks until the script has finished executing?
Do you have access to a crontab facility? Writing a shell script* that sends needed mails and configuring it to execute at regular intervals can be a good option.
(*) Shell scripts can be written in PHP too.
i don't want to do a crontab, because ideally i'd like 'instant'
notification when a job is posted... but i suppose an hourly crontab might
not be TERRIBLE...
Daniel Tryba <pa**********@i nvalid.tryba.nl > wrote in
news:42******** *************** @news6.xs4all.n l: Good Man <he***@letsgo.c om> wrote: Does anyone have any thoughts as to how I can send the emails without preventing the administrator from doing other tasks until the script has finished executing? [snip]
Better yet would be to create a que mechanism, add email and body to a database and have a script periodically check if there are entries to be sent. That way there is only 1 process trying to spam^Wsend email you have to look after.
you clever devil, thanks for the suggestion!
*** Good Man wrote/escribió (Thu, 23 Jun 2005 08:37:28 -0500): i don't want to do a crontab, because ideally i'd like 'instant' notification when a job is posted... but i suppose an hourly crontab might not be TERRIBLE...
Or even a Once Every Fifteen Minutes if necessary, given the script is
designed to cause little load if no work left and to stand ocasional
overlappings.
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
GM,
I assume you're using Linux here, right? It works much better that way
for this kind of thing. The way I do it is to have my PHP fork off
another PHP page to do the work. In my case, I have a work order
ticketing system. I don't want to hold up the user while the mail
server is busy, so I fork off a process in RAM and then return the user
immediately back with a message that the email will be sent to the user
shortly. On my web server in a given day, you may see a couple dozen of
these forked files in RAM, waiting for the slow mail server in our
corporate intranet to respond over the T1 connection. The queue
mechanism is better because of error control, but my mechanism is the
poor man's version. You can build the queue with a database and a cron
job that calls the PHP page to read the database, send the email, and
go back to sleep again until the next cron wakeup time. Your task,
then, would be to only file these entries in the database.
Q: How can I send bulk mails with PHP?
A: PHP may not be the right choice for sending bulk mails. PHP's
built-in mail() function is written to use sendmail binary; and higher
performance is not usually expected. It is also suggested that qmail is
faster than sendmail; to make PHP to use qmail instead of sendmail, one
has to work on the make and installation process. There are many (C
based) applications available to speed up sendmail.
Another suggestion is to sort the email addresses based on domain names
and deliver them using BCC. Most of the time, this will make the mail
to be delivered in junk folder as many spam guards trap BCCed mails.
Many commercial bulk mailers such as LISTSERV guarantee high speed
delivery as they seem to use higher-end hardwares and resources.
Refer:
1. http://www.php.net/mail
2. ftp://cs.utk.edu/pub/moore/bulk_mail..._mailer.README
+++++
@todo Grammar cleanup.
Good Man wrote: Hi
I'm building a 'job posting' site of sorts.
When a job is available in a particular state, I want the system to send an email to everyone who is 'watching' that state.
I know how to do this, but I need to figure out a way to 'send the emails in the background' - ie: if an administrator adds a job to Wyoming, I don't want them to have to wait for the php script to finish selecting and e- mailing everyone watching the state before the administrator can move on and do other things.
I originally thought that passing this task to the PHP command line would do the trick, but it turns out that a script like...
exec("my php script that emails people"); echo "complete!" ;
...does not echo "complete!" until the thousands of people have all had their info passed to the mail server (a long time).
I suppose that I could get rid of this by just lumping everyone together in the Bcc: field of a single e-mail message, but at this point I'd like to keep that as a last resort and go with the personalization ("Hi James... a job has been posted in Wyoming").
Does anyone have any thoughts as to how I can send the emails without preventing the administrator from doing other tasks until the script has finished executing?
I've implemented a queue mechanism in the past; it works fine, and you
can control the rate your messages are sent independent of the UI. I
did it all in PHP and MySQL with a cron job to kick off the queue runner
every 15 minutes (sufficient for my purposes).
Later I rewrote the queue runner in C, but didn't have any noticeable
effects. The PHP code for this was so small it really didn't matter much.
The only thing you want to be careful of is that you don't have two
queue runners going at the same time (i.e. one starts before the
previous one finishes). Depending on timing and exactly how you wrote
the code, you could get duplicate emails sent. You can protect it in
the code - but I found it much easier to just check to see if another
copy was running in a startup script and not start the job if there is.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== === This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dan glenn |
last post by:
I'm creating HTML emails from a PHP site and sending them out to an email
list (just about 40 people so far are on this list). I've tested and
confirmed that these emails work in yahoo.com's webmail. And I know they
work on *my* Outlook Express. But I have one person (I know of) who gets the
emails as plain text, so she sees the HTML code for the email instead of its
proper representation. She has, like myself, OE6, and other html emails...
|
by: Stuart Mueller |
last post by:
I have an exchange server, that I sometimes use to perform mail shots to
clients on our database, these can be upwards of 1000 at a time.
As we don't want different clients to see who we are working with we put
these mailshots in the bcc field of the mails.
This can sometimes cause a problem as we are getting alot of mails bounced
back. I would like to write a script to have these emails sent
out individually using the to: field of the...
|
by: martin smith |
last post by:
Here's the scenario. I'm currently using cdosys/asp to send mail to
our SMTP server. We use a product called MailFilter to check for SPAM.
It doesn't work very well. If MailFilter isn't working cdosys also has
problems and emails don't get sent. As these email are confirmations
for customer's bookings this means lots of customers calling to see
where their confirmation emails have gone. The root of the problem is
MailFilter but that here...
|
by: Mr. x |
last post by:
Hello,
I am sending emails with Hebrew contents.
When receiving emails - I cannot see the Hebrew characters (it is not
outlook express configuration, because when receiving emails from friends -
I see hebrew, it is just sending by myself using *.aspx scripts).
In web.config I have the following :
<configuration>
<system.web>
|
by: Lau |
last post by:
I need to send 1000 emails from an asp.net website.
Normally I would use System.Web.Mail.MailMessage() to send thru an SMTP
server.
But the large amount of emails results in a timeout. My server administrator
told me to write the emails to the “pickup directory†instead. I know that
JMail can do this in ASP, but how do you do this in asp.net?
--
--------------------
| |
by: A |
last post by:
Hi all!
I would like to ask a question on sending emails...
I have a web application that requires sending emails using email templates.
The templates that I've made are separate HTML files and would require some
data based on what the user has entered.
Please help!!!
|
by: Ant |
last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send
mail, however it's not sending any emails.
I'm using it on a Windows 2003 server.
The simplest way to use this is
smtpMail.Send("from@here.com", to@there.com, "Message subject", "Message
Body")
I'm sending it to my own email address on a different server using a dummy
|
by: Kun |
last post by:
i have the following code:
----------------------------------
import smtplib
from email.MIMEText import MIMEText
fp = open('confirmation.txt', 'rb')
msg = MIMEText(fp.read())
From = 'xxxx@xxxx.xxxx.edu'
|
by: robbiesmith79 |
last post by:
Just so this is out there on the web, I battled the past 24 hours
about this. Background info... I developed a ecommerce website in PHP
4 on a shared linux hosting plan from GoDaddy and had the html
formatted emails sending as text/html and were going fine with limited
header information. Then we moved the site over to a Dedicated Linux
hosting plan. This time, it's PHP 5. Things are bound to not work as
expected moving to a new...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |