Gossamer Forum
Home : General : Perl Programming :

sending cc emails

Quote Reply
sending cc emails
i'm going thru list of emails and sending individual emails. i want an option to add the emails to a cc field instead of sending individual emails. here's excerpt of my code.
Code:
my $email = Email::MIME->create(
header_str => [
From => $from,
To => [ $to ],
Return-Path => $returnpath,
Cc => $cc,
Reply-To => $reply_to,
Subject => $subject,
],
parts => \@all_parts,
attributes => {
encoding => 'base64',
content_type => "multipart/mixed"
}
);

sendmail($email->as_string);



each individual email is in $to as it cycles thru list.
first, is it possible to do what i want? if so, what format should $cc be? ( i want to add the addresses to $cc)
Quote Reply
Re: [delicia] sending cc emails In reply to
i think i figured it out (first thing i tried!):

Code:
$cc .= $rec{$db_email_field} . ',';

i just separated the addresses with a comma
Quote Reply
Re: [delicia] sending cc emails In reply to
Hi,

I'm not sure thats doing what you are expecting. I would check what the output of this is:

Code:
print "Content-Type: text/html \n\n";
print $email->as_string. "\n";

See what the headers look like there to make sure its what you are expecting.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] sending cc emails In reply to
it did what i expected but i changed $cc to $to because i noticed that's how most of the emails i receive are addressed. it's working perfectly!
Quote Reply
Re: [delicia] sending cc emails In reply to
What does your CC header look like? To me it seems like it would have a , at the end, which isn't a valid email format (it may work on some, but will bounce on any that enforce the rules)

i.e:

Code:
CC: andy.newby@bla.com,

is not valid.

Code:
CC: tesT@bla.com, andy.newby@bla.com,

That would work as well

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] sending cc emails In reply to
ok, i'll remove the trailing comma. thanks!
Quote Reply
Re: [delicia] sending cc emails In reply to
(I'm still confused as to why you are appending with .= on $cc. ... what exists in $cc to start with?)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] sending cc emails In reply to
not using cc any more. using $to instead
Quote Reply
Re: [delicia] sending cc emails In reply to
there was no trailing comma on the $to string. do you think sendmail removed it automatically?
Quote Reply
Re: [delicia] sending cc emails In reply to
Hmm it wouldn't normally. Bit hard to see without a full debug, and TBH I don't really have time to start digging into it :) If it works, I guess it works.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!