SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy [frustrated] Help with e-mail headers and Bcc stuff

    I'm writing a script that handles incoming e-mail and stores it in a database.

    How it works is, I pipe all e-mail that goes to anything-you-want@example.com and use a PHP script to decode the message:
    PHP Code:
    #!/usr/bin/php -q
    <?php
    $fp 
    fopen('php://stdin''r');
    while(!
    feof($fp) ){
        
    $message .= fgets($fp4096);
    }
    fclose($fp);

    // decode $message using a class (mimeDecode.php)
    ?>
    All is well, until the horrific Bcc: feature we all like.

    The thing is, if an e-mail is sent to chen@example.com, I need to store the data in chen's account. Easy, when chen@example.com is in the To/Cc: line.

    But, when I send an e-mail like this:
    To: chen@example.com
    Cc: chris@wrong.net
    Bcc: more@example.com

    The e-mail only hits the example.com server once (not twice like my common sense would think). The problem is, I need to store this message twice, once for chen's account, and another time for more's account.

    The problem is, that more@example.com is never shown in the mail headers (obviously, because it's a blind courtesy copy). I can't for the life of me figure out how to tell the script that it needs to insert the data into more's account as well!

    Any help would be greatly appreciated as this is vital to my project.

    Thanks in advance.

  2. #2
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please help, I am very very desperate.
    Any nudge in the right direction would be great.

  3. #3
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry I can't help. It is an interesting conundrum. The Bcc header is not delivered in the email that you are piping to your script.

    May I ask, what delivering to an "account" means? I am just curious. Are you storing the mail in a database? The reason I ask is that I use a postfix as a mail server, and there is almost nothing you can't do with it in terms of getting it to deliver mail to almost anywhere - mysql or postgresql databases, Berkely DB3 databases, practically anywhere!

    <<edirt>> hehe - ok so I read your OP again, and see you are delivering to a database. Well, if it is at all relevent to your situation, I would definitely use a MTA like postfix which you can configure to do all this for you.

  4. #4
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks freakysid!

    I don't know what an MTA or Postfix is, but that's is definitely some food for thought. *goes to Google*

  5. #5
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MTA mail transprort agent, that is, the mail server running on your server. Sendmail, qmail, postfix, etc.

    Of course, to be able to set up and customise your mail server the way you want it, you would, in practice, need to be running your own server. I don't know the scale of your project and whether this would be relevent to your situation.

  6. #6
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm testing it on my server but it's planned to work on another.

    I'm currently looking at other softwares of this kind, hopefully I can find the answer there.

  7. #7
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kevin just published an article on advanced email in PHP. It is interesting because I was having problems with BCC too, and it turns out that, basically, Bcc doesn't work.

    Full story: http://www.webmasterbase.com/article/679
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  8. #8
    Custom User Title v1.0 FireFly's Avatar
    Join Date
    Aug 2001
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes I read that article as well (good), but that one talks about sending out e-mail, I'm dealing with incoming messages.

  9. #9
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by FireFly
    Yes I read that article as well (good), but that one talks about sending out e-mail, I'm dealing with incoming messages.
    <GRABS GLASSES>

    Oops! Sorry!
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •