CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
How do you send the same email to multiple recipients with Sendmail & PERL?

 



lisali
New User

Nov 20, 2016, 4:20 PM

Post #1 of 5 (8499 views)
How do you send the same email to multiple recipients with Sendmail & PERL? Can't Post

Hello!

I have the following PERL script, but I can't seem to get it to send to more than one email at once. How do I send to multiple emails within the same script, preferably as separate emails, CC, BCC or just an additional TO:?

Thank you! :)


Code
 
open(SENDMAIL, "|/usr/lib/sendmail -oi -t") || die "Cannot open sendmail output";

print SENDMAIL <<"ENDENDEND";
From: <test\@test.com>
To: <test1\@test1.com>
Subject: report spam
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="DeathToSpamDeathToSpamDeathToSpam"

This is a multi-part message in MIME format.
--DeathToSpamDeathToSpamDeathToSpam
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


--DeathToSpamDeathToSpamDeathToSpam
Content-Type: message/rfc822
Content-Disposition: attachment

ENDENDEND

while (<STDIN>) {
print SENDMAIL ;
}


print SENDMAIL <<"ENDENDEND";

--DeathToSpamDeathToSpamDeathToSpam--
ENDENDEND

close (SENDMAIL);



Laurent_R
Veteran / Moderator

Nov 20, 2016, 11:15 PM

Post #2 of 5 (8494 views)
Re: [lisali] How do you send the same email to multiple recipients with Sendmail & PERL? [In reply to] Can't Post

Hmm, I can't test right now and there are different versions of the sendmail program, but I thing you can just use a list of adressees instead of just one:


Code
To: <test1\@test1.com test2\@test2.com test3 ...>


Having said that, I would recommend that you use a CPAN mail/mime module.


lisali
New User

Nov 21, 2016, 5:40 AM

Post #3 of 5 (8487 views)
Re: [Laurent_R] How do you send the same email to multiple recipients with Sendmail & PERL? [In reply to] Can't Post

Hi!

Thanks so much for your message.

That does not seem to work - it doesn't send any messages. :(

Any other suggestions? Adjusting this was hard enough for me, so I wouldn't even know where to start if using a different module.


lisali
New User

Nov 21, 2016, 5:57 AM

Post #4 of 5 (8486 views)
Re: [lisali] How do you send the same email to multiple recipients with Sendmail & PERL? [In reply to] Can't Post

For some reason, using Bcc: or adding another To: email does NOT work, but Cc: seems to do it. :)


Laurent_R
Veteran / Moderator

Nov 21, 2016, 9:52 AM

Post #5 of 5 (8481 views)
Re: [lisali] How do you send the same email to multiple recipients with Sendmail & PERL? [In reply to] Can't Post

This is not really a Perl question. You should really check the documentation or your version of the sendmail program:

Code
man sendmail


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives