473,586 Members | 2,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multithread a process

Hello,

can i use php to multithread mail() or something similar? in my company
i need to send multiple copies of email to a few hundred ppl affilated
and on my list.

instead of calling mail over and over again i would like to thread this
process.

could someone point me to some documentation or perhaps an example of
where to start with this?

cheers

-jpdr
TTG

Jul 16 '05 #1
12 8601
On Mon, 18 Aug 2003 14:22:54 +0000 (UTC) in
<message-id:bh********** @hercules.btint ernet.com>
haptiK <ha****@yahoo.c om> wrote:
Hello,

can i use php to multithread mail() or something similar? in my
company i need to send multiple copies of email to a few hundred ppl
affilated and on my list.

instead of calling mail over and over again i would like to thread
this process.

could someone point me to some documentation or perhaps an example of
where to start with this?

cheers

-jpdr
TTG

bcc the mails?

Regards,

Ian
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
Programming, Web design, development & hosting.
Jul 16 '05 #2
hello Ian :)
Thanks for your response.

I'm not completly sure what Bcc does, but i do know it is a Blind Carbon
Copy meaning everyone gets a copy of the email without anyone else
knowing who recieved it.

I would still like to discuss threading the mail process.

any other ideas?

Ian.H [dS] wrote:
On Mon, 18 Aug 2003 14:22:54 +0000 (UTC) in
<message-id:bh********** @hercules.btint ernet.com>
haptiK <ha****@yahoo.c om> wrote:

Hello,

can i use php to multithread mail() or something similar? in my
company i need to send multiple copies of email to a few hundred ppl
affilated and on my list.

instead of calling mail over and over again i would like to thread
this process.

could someone point me to some documentation or perhaps an example of
where to start with this?

cheers

-jpdr
TTG


bcc the mails?

Regards,

Ian


Jul 16 '05 #3
On Mon, 18 Aug 2003 14:42:38 +0000 (UTC) in
<message-id:bh********** @hercules.btint ernet.com>
haptiK <ha****@yahoo.c om> wrote:
hello Ian :)
Thanks for your response.

I'm not completly sure what Bcc does, but i do know it is a Blind
Carbon Copy meaning everyone gets a copy of the email without anyone
else knowing who recieved it.

Yup, pretty much you'd set the 'To' header to your own mail address,
then list the others as people to BCC.

This would then just use a single mail() call rather than a looped
version.


I would still like to discuss threading the mail process.

any other ideas?

Fair enough.. but can't offer any advice / ideas on this part.. not
actually thought it in the past tbh.. so I'm at a loss for info there
=)

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
Programming, Web design, development & hosting.
Jul 16 '05 #4
haptiK wrote:

[snip BCC]
How then would this behave if im sending thousands of emails to my users
as opposed to threading the mail process? over all performance?


Far better. It's the mail server doing the work, not the PHP script. This
also means you don't disclose everybody's email address, which isn't a very
nice thing to do to people who don't want to get spammed.
--
Jim Dabell

Jul 16 '05 #5
Hi,

haptiK wrote:
How then would this behave if im sending thousands of emails to my users
as opposed to threading the mail process? over all performance?

thanks again for your response.. im new to the theory of threaded
processes and they sound interesting but if im headed down the wrong
trail with this i appreciate your patience.


Using Bcc, with the Bcc field containing the thousands of addresses,
means the the PHP process only sends one email to your mail server very
quickly. It is then up to the mail server to copy it out to everyone on
the Bcc list. This is also more efficient for the Internet, as if 200
people at example.com need a copy, your mail server will pass 1 copy to
example.com's email server with the 200 recipients listed, and
example.com's mail server will copy that message to all 200 people,
saving a lot of Internet bandwidth.

You couldn't easily use multithreading easily for what you want, as the
PHP process (and so page transfer) won't finish until all the threads
finish (you could possibly make your web server stop the request by
closing the filehandle, but its not guaranteed - your web server might
wait until it can reap the process).

You could use program execution functions (eg fork() and exec() under
Unix, or your OS moral equivilent) to send the messages from another
process and then have the main process return before the other one, but
check you don't end up with zombies.

Most Internet people would prefer you use the 1st method,

Bcc: a@example.com, b@example.net, c@example.org

Because it saves bandwidth, and if two addresses are mapped to the same
account they often won't get duplicates, but it does mean you can't
'personalise' the emails. But it also neatly puts the time-to-send
problem off PHP and on to the mail servers, optimised to do the job :-)

Regards,

Luke

Jul 16 '05 #6
Greetings Mr Ross.

Fantastic argument and I understand completly now why Bcc: is the best
option over trying to thread via php.

Thank you for your timely responses everyone.

- jpdr
TTG

Luke Ross wrote:
Hi,

haptiK wrote:
How then would this behave if im sending thousands of emails to my
users as opposed to threading the mail process? over all performance?

thanks again for your response.. im new to the theory of threaded
processes and they sound interesting but if im headed down the wrong
trail with this i appreciate your patience.

Using Bcc, with the Bcc field containing the thousands of addresses,
means the the PHP process only sends one email to your mail server very
quickly. It is then up to the mail server to copy it out to everyone on
the Bcc list. This is also more efficient for the Internet, as if 200
people at example.com need a copy, your mail server will pass 1 copy to
example.com's email server with the 200 recipients listed, and
example.com's mail server will copy that message to all 200 people,
saving a lot of Internet bandwidth.

You couldn't easily use multithreading easily for what you want, as the
PHP process (and so page transfer) won't finish until all the threads
finish (you could possibly make your web server stop the request by
closing the filehandle, but its not guaranteed - your web server might
wait until it can reap the process).

You could use program execution functions (eg fork() and exec() under
Unix, or your OS moral equivilent) to send the messages from another
process and then have the main process return before the other one, but
check you don't end up with zombies.

Most Internet people would prefer you use the 1st method,

Bcc: a@example.com, b@example.net, c@example.org

Because it saves bandwidth, and if two addresses are mapped to the same
account they often won't get duplicates, but it does mean you can't
'personalise' the emails. But it also neatly puts the time-to-send
problem off PHP and on to the mail servers, optimised to do the job :-)

Regards,

Luke


Jul 16 '05 #7
haptiK wrote:
Thanks for your response, yes actually avoiding spam is a major
intention here.. thank you for your response i will take this into
account.


Oops, sorry, I forgot the context for a second. There's no problem with
sending individual mails from an email disclosure point of view, only when
CCing (instead of BCCing). The rest applies though - you are essentially
just supplying the mail server with the email and a list of addresses,
rather than an individual email for each address.
--
Jim Dabell

Jul 16 '05 #8
On Tue, 19 Aug 2003 19:25:35 +0200 in
<message-id:bh********** **@news.t-online.com>
Jochen Buennagel <za**@buennagel .com> wrote:
haptiK wrote:
Fantastic argument and I understand completly now why Bcc: is the
best option over trying to thread via php.


There is a (growing) problem with this: A number of email services
(most notably hotmail) have started to classify emails as spam if the
recipient is not in the "To:" or "Cc:" fields.

ZangBunny

Sounds like another good enough reason not to use Hotmail =)

Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
Programming, Web design, development & hosting.
Jul 16 '05 #9
Jochen Buennagel wrote:
haptiK wrote:
Fantastic argument and I understand completly now why Bcc: is the best
option over trying to thread via php.


There is a (growing) problem with this: A number of email services (most
notably hotmail) have started to classify emails as spam if the
recipient is not in the "To:" or "Cc:" fields.


Really? That practice would give an amazing amount of false positives.
Basically any legitimate bulk mail. I've just tested it with Hotmail, and,
with the default settings, BCCed email gets through just fine. It may be
that at higher spam filtering settings, it does not get through, but
Hotmail explicitly tells you that you could miss legitimate email with
these settings, so I'd regard that as acceptable loss. After all, if
that's all it takes to get classed as spam, then they must be missing more
than just a few emails from you.
--
Jim Dabell

Jul 16 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
7007
by: dbmethods | last post by:
Could someone give a hint on how to do multithread programming with PHP scripting here? Thanks
4
3099
by: Michael Shestero | last post by:
Hello. I have some function f(stream* out) that makes text-output into stream (*out) i.e. (*out)<<"Hello"<<endl;. The (*out) can be cout, ofstream, a strstream, etc. This function working in the background process (thread). The main process need to receive this outout for the further transfering into console-like window or something else....
0
1852
by: r_obert | last post by:
Hello, I'm trying to create a worker thread for my VC++ program, and was wondering whether I should be linking with the Multithread /MT or Multithread DLL /MD option? I'm not quite sure, in layman's terms, what the difference is. When I build with Multithread DLL, the linker complains about not being able to find a bunch of "unresolved...
4
7071
by: zbcong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting for a incoming connection,the relative code snipprt as following:: private IPAddress myIP=IPAddress.Parse("127.0.0.1"); private IPEndPoint myServer;...
2
26491
by: zhebincong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting for a incoming connection,the relative code snipprt as following:: private IPAddress myIP=IPAddress.Parse("127.0.0.1");
5
1367
by: Ekempd | last post by:
Hi I need some advice about this situation an how I'm current handling it I hava a ASP.NET solution that in some point start multiples lenghty verification agains diferent databases, my big challenge is that the user click in a button "start process" and close the explorer windows... and in the backgroud all the required query are executed,...
6
2818
by: jmartin | last post by:
Hi, I have made a multithread version of a program (load a file into database), and with two processors I get the double of time in the multithread than in the process (unithread) version. I have done the test of creating a unique thread that does the same code that the process version of the program and it takes more time that the...
0
1396
by: Gordon Cone | last post by:
I am currently debugging a deadlock in a multithread C# application. It makes lots of calls to legacy unmanaged code. The application runs on windows sever 2003 and uses the sever version of the CLR. The application runs on ..NET 1.1 SP1. When the deadlock happens the process is using 0 CPU. I was able to collect crash dumps and have...
0
2744
by: Gordon Cone | last post by:
I am currently debugging a deadlock in a multithread C# application. It makes lots of calls to legacy unmanaged code. The application runs on windows sever 2003 and uses the sever version of the CLR. The application runs on ..NET 1.1 SP1. When the deadlock happens the process is using 0 CPU. I was able to collect crash dumps and have...
0
7911
marktang
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...
0
8200
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7954
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...
0
8215
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
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...
0
5390
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...
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1179
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.