Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Mail tool to add CC and BCC

by kprasanna_79 (Hermit)
on Sep 02, 2011 at 06:23 UTC ( [id://923769]=perlquestion: print w/replies, xml ) Need Help??

kprasanna_79 has asked for the wisdom of the Perl Monks concerning the following question:

Revered Monks,

I am using legacy perl (IO::Scoket) tool to send and recieve mail. I dont see any option there to BCC and CC. Can anybody have a shorcut idea to send them by any means. I see some third party tools, but if it there inside this, i can use them


-Prasanna.K

Replies are listed 'Best First'.
Re: Mail tool to add CC and BCC
by atcroft (Abbot) on Sep 02, 2011 at 06:52 UTC

    You do know the difference between headers and envelope headers, right?

    Since you didn't provide an example of the code you are looking at, let's take a different approach to showing what happens... If I want to send an email by connecting to a mail server (for instance, through a telnet program), it would look something like this:

    $ telnet mail.example.com 25 Trying 127.0.0.42... Connected to mail.example.com (127.0.0.42). Escape character is '^]'. 220 mail.example.com ESMTP HELO mail.example.org 250 mail.example.com MAIL FROM: <sender@example.org> 250 ok RCPT TO: <recipient1@example.com> 250 ok RCPT TO: <recipient2@example.com> 250 ok RCPT TO: <recipient3@example.com> 250 ok DATA 354 go ahead Date: 02 Sep 2011 01:45:59 -0500 Subject: test From: "Sender" <sender@example.org> To: "Recipient 1" <recipient1@example.com> CC: "Recipient 2" <recipient2@example.com> test . 250 ok 1314945967 qp 19908 quit 221 mail.example.com Connection closed by foreign host.

    What this means is that BCC recipients are those who appear in the envelope header (RCPT TO lines), whereas TO and CC recipients appear both there and in the DATA section of the email.

    This gives you the following email:

    Received: (qmail 12019 invoked from network); 2 Sep 2011 01:46:09 -0500 Received: from mail.example.org (HELO mail.example.org) (127.0.0.23) by mail.example.com with SMTP; 2 Sep 2011 01:46:20 -0500 Received-SPF: pass (mail.example.org: SPF record at example.org designates 127.0.0.23 as permitted sender) Date: 02 Sep 2011 01:45:59 -0500 Subject: test From: "Sender" <sender@example.org> To: "Recipient 1" <recipient1@example.com> CC: "Recipient 2" <recipient2@example.com> test

    Hope this helps.

    Update: 2011-09-02
    Added sample email output.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://923769]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-03-29 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found