I am in preliminary design of a contact management program. The
user would like to use his current mail server (POP3 - remote).
I have done some reading on the IMAP functions but am unclear if
the following is possible:
Using the IMAP functions can I write a PHP script to:
scan the subject lines of all mail in the mailbox ?
pop just certain messages from the inbox ?
delete those messages from the inbox ?
all without disturbing the other messages in his inbox that are
downloaded to his usual email client (Thunderbird).
If anyone can suggest a better way to do this, I am all ears.
bill 4 4176
On 22 Mar, 11:18, bill <nob...@spamcop .netwrote:
I am in preliminary design of a contact management program. The
user would like to use his current mail server (POP3 - remote).
<snip>
Using the IMAP functions can I write a PHP script to:
scan the subject lines of all mail in the mailbox ?
pop just certain messages from the inbox ?
delete those messages from the inbox ?
Yes. Something like...
$in=imap_open(. ..);
$msgs=imap_head ers($in); // gets the headers from the currently
available msgs
foreach ($msgs as $index=>$header ) {
if (strstr($header , $look_for)) { // may want to explicitly extract
the subject
$email=imap_fet chstructure($in , $index);
if ($email && save($email)) {
imap_delete($in , $index);
}
}
}
imap_expunge($i n);
imap_close($in) ;
all without disturbing the other messages in his inbox that are
downloaded to his usual email client (Thunderbird).
....but you need to make sure that he doesn't delete your meassages
from the mailbox when he downloads the other stuff.
If anyone can suggest a better way to do this, I am all ears.
It'd be a lot better to handle the messages synchronously, e.g. with a
custom procmail script launching the PHP script. But that rather
depends on having POSIX or similar on the MTA or MUA box.
C.
Hello,
on 03/22/2007 08:18 AM bill said the following:
I am in preliminary design of a contact management program. The user
would like to use his current mail server (POP3 - remote).
I have done some reading on the IMAP functions but am unclear if the
following is possible:
Using the IMAP functions can I write a PHP script to:
scan the subject lines of all mail in the mailbox ?
pop just certain messages from the inbox ?
delete those messages from the inbox ?
all without disturbing the other messages in his inbox that are
downloaded to his usual email client (Thunderbird).
If anyone can suggest a better way to do this, I am all ears.
You may want to take a look at this POP3 class. You can use the class
RetrieveMessage function to retrieve just the message headers and get
only the first body lines you need. http://www.phpclasses.org/pop3class
You can also this MIME message parser class that can decode message and
extract headers that use non-ASCII characters. I think you need that to
filter message by subject or sender, as messages with non-ASCII
characters are encoded with q-encoding like this:
=?iso-8859-1?Q? http://www.phpclasses.org/mimeparser
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/
C. wrote:
On 22 Mar, 11:18, bill <nob...@spamcop .netwrote:
>I am in preliminary design of a contact management program. The user would like to use his current mail server (POP3 - remote).
<snip>
>Using the IMAP functions can I write a PHP script to: scan the subject lines of all mail in the mailbox ? pop just certain messages from the inbox ? delete those messages from the inbox ?
Yes. Something like...
$in=imap_open(. ..);
$msgs=imap_head ers($in); // gets the headers from the currently
available msgs
foreach ($msgs as $index=>$header ) {
if (strstr($header , $look_for)) { // may want to explicitly extract
the subject
$email=imap_fet chstructure($in , $index);
if ($email && save($email)) {
imap_delete($in , $index);
}
}
}
imap_expunge($i n);
imap_close($in) ;
THank you.
>
>all without disturbing the other messages in his inbox that are downloaded to his usual email client (Thunderbird).
...but you need to make sure that he doesn't delete your meassages
from the mailbox when he downloads the other stuff.
>If anyone can suggest a better way to do this, I am all ears.
It'd be a lot better to handle the messages synchronously, e.g. with a
custom procmail script launching the PHP script. But that rather
depends on having POSIX or similar on the MTA or MUA box.
C.
I don't have control over the MTA, which is on a mail server that
is not under the same ownership as the php server.
bill
Manuel Lemos wrote:
Hello,
on 03/22/2007 08:18 AM bill said the following:
>I am in preliminary design of a contact management program. The user would like to use his current mail server (POP3 - remote).
I have done some reading on the IMAP functions but am unclear if the following is possible:
Using the IMAP functions can I write a PHP script to: scan the subject lines of all mail in the mailbox ? pop just certain messages from the inbox ? delete those messages from the inbox ?
all without disturbing the other messages in his inbox that are downloaded to his usual email client (Thunderbird).
If anyone can suggest a better way to do this, I am all ears.
You may want to take a look at this POP3 class. You can use the class
RetrieveMessage function to retrieve just the message headers and get
only the first body lines you need.
http://www.phpclasses.org/pop3class
You can also this MIME message parser class that can decode message and
extract headers that use non-ASCII characters. I think you need that to
filter message by subject or sender, as messages with non-ASCII
characters are encoded with q-encoding like this:
=?iso-8859-1?Q?
http://www.phpclasses.org/mimeparser
Thank you This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Alexander Franksmann |
last post by:
Hello,
I'm going to write a anti-spam-program based on a Whitelist.
"If the mail sender is found in the database, my program should move
the mail into another mailbox"
The mailserver fetched the mails from the clean pop3-account.
The problem is a problem because the function imap_move() can only
move mails from one folder in the mailbox into another folder.
I hope someone could help me.
|
by: Paul Schmidt |
last post by:
Dear list:
I am new to python, and I am trying to figure out the short answer on
something.
I want to open a POP3 mailbox, read the enclosed mail using the POP3
module, , and then process it using the email module.
Environment Python 2.3.4, Mandrake Linux 9.0 patched up the wazoo...
|
by: Lev Altshuler |
last post by:
Hi,
I am trying to count email messages in the mailbox and read their headers.
In case that there are some messages on the POP3 server and
they haven't yet got to the Inbox, I get a number of messages.
As soon as they have been in the Inbox, I get '0E0' as a number of messages.
Does anyone know what feature of Net::POP3 I am not aware of, or
where did I screw up in the code?
use Net::POP3;
|
by: gj |
last post by:
I have an application in Access 97 I will be rewriting in the latest
version of Access in 6 months. In the meantime, does anyone know of an
ActiveX control I can add into an Access 97 form to allow the validation
of Credit Card numbers and also processing of payments.
Ta very muchly.
GJ
|
by: Mike Brearley |
last post by:
I need to write a script that will check a catch-all mailbox (pop3) and send
a non delivery report back to the sender of the email.
Background info:
I have a domain hosted on a site that offers unlimited email accounts... the
problem is, emails sent to an invalid address on the domain aren't
automatically returned as non-deliverable. I am, however, able to set up a
catch-all address and able to pick up those emails. Id like to set up a...
| |
by: Gabe Matteson |
last post by:
Good morning,
The point of this posting is to find out a way to insert downloaded
email into your exchange mailbox.
1. I know how to download pop3 mail using asp to a web page.
2. i would like to add a link on the exchange webmail options page which i
successfully can that would load up my asp page which downloads email from
my pop3 mailbox. i.e. my cox address. i would like to send all my mail that
shows up in my web page to my exchange...
|
by: bobano |
last post by:
Hi everyone,
I am writing a POP3 Client program in Perl. You connect to a POP3 Server and have a running conversation with the mail server using commands from the RFC 1939 Post Office Protocol. This program can perform 5 options from a menu on your POP3 mail by logging in with the correct POP3 server along with a user name and password that you use to log in to your ISP. The user name and password as well as the server name are all hard-coded...
|
by: Craig Buchanan |
last post by:
I would like to monitor a POP3 mailbox with multiple clients. However, I want
to ensure that each message is processed by only one client. In essence, I
would like to treat a POP3 mailbox like a queue.
From what I've read thus far, atomic message access (if this is the right term)
isn't a native feature of the POP3 protocol. Am I mistaken?
My approach thus far, is to have one thread connect to the mailbox periodically,
look for new...
|
by: wassimdaccache |
last post by:
Dear
I installed a pop3 service on windows server 2003 Enterprise X64. I am using it to send email internally.
I am adding mailbox using pop3 service administrative in the control panel.
It is working well but the problem is:
I am not able to send email with an attachment greater than 1 MB
Could anyone tell me where I can precise the quotation email size for each user ???
|
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: 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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
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...
| |