I send periodic emails to a variety of clients and the addresses change with the variety. I currently a form for the email composition and address the email to "undisclosed recipients (my email address) with BCC's going to the individual clients. I use the following code to accomplish that.
##sendmail_email.pl #!C:/Perl/bin/perl -w use CGI qw(:standard); use HTML::Entities; use Mail::Sendmail 0.79; # doesn't work with v. 0.74! my $Recipient=param('Recipient'); my $Sender=param('Sender'); my $bcc_list=param('bcc_list'); my $Subject=param('Subject') my $Message = param ('Message'); $html = <<END_HTML; <p>$Message</p><p><font size="2"> END_HTML my %mail; $mail{Smtp}="smtp.sendgrid.net"; $mail{Port}=587; $mail{Auth}={user=>"Milt1", password=>"XXXXXXX", method => "LOGIN", re +quired => 1}; $mail{To}=$Recipient; $mail{From}= $Sender; $mail {bcc}="$bcc_list"; $mail{Subject}=$Subject; $mail{'content-type'} = 'text/html; charset="iso-8859-1"'; $mail{body} = <<END_OF_BODY; <html>$html</html> END_OF_BODY sendmail(%mail) || print "Error: $Mail::Sendmail::error\n"; &redirect; sub redirect { print header(), start_html; print "Your Message Was Sent\n\n"; } exit;
I want to address each client individually by name and not utilize BCC's. Can this be done without reading from a 'file' saved on the server or can it be done by pasting the list into text area on the form named "Email_List", input into the cgi as: my $Email=param ('Email_List'); put into and array and read with a foreach loop? Something like this:
my@=<$Email>; if (@a) { foreach $Address(@a) { $Recipient=$Address; } }
I haven't been able to get any of several trials to work. Any help/suggestions will be sincerely appreciated. Thanks!
In reply to Email To A List Of Addresses by Milti
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |