in reply to Sending Email to a list of people using Mail::Sender
toSo,=> the recipient's address(es)
This parameter may be either a comma separated list of email addresses or a reference to a list of addresses.
- Read the addresses from a file
- Push each one on to an array, say @addresses
- Modify the OpenMultipart call to:
$sender->OpenMultipart({ to => \@addresses, subject => "$Subject", });
- Profit!
Perl: perlintro perlretut Basic debugging checklist Yes, even you can use CPAN
PerlMonks: How do I post a question effectively? Markup in the Monastery How do I post a question effectively? I know what I mean. Why don't you?
General: How To Ask Questions The Smart Way What every computer scientist should know about floating-point arithmetic
To Be Continued...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Sending Email to a list of people using Mail::Sender
by mlebel (Hermit) on Aug 14, 2011 at 14:43 UTC | |
OK.. So I cleaned up a few things from the recommendations that some of you made. (thanks) I then got FunkyMonk's Message and I must say that I did read the documentation on Mail::Sender (I had to since I am new to perl and needed to know how it initially worked) I guess the real problem is that I wasn't 100% sure what they meant by "This parameter may be either a comma separated list of email addresses or a reference to a list of addresses." Initially, I had created a list of comma separated addresses(within the script) and it worked. When I moved that list to the new file, it didn't work. I assume that this is where the "reference to a list of addresses" comes in at. Perhaps Someone can give me the right syntax since I still cannot get it to work. (for the push part). Here is my "real" code that I have modified so far. Since my script is over 1000 lines therefore I am only posting a portion of it and it's very likely that I may be missing stuff. This is not my final code, this is my code in progress. ( so commented out stuff that i tried is also in there too ) Either way, the code works when within the script, it just doesn't work outside of it. Here it is: The options file:
The Script File:
So I beleive FunkyMonk is on the right track to what I am looking for. Thanks. | [reply] [d/l] [select] |
by wfsp (Abbot) on Aug 14, 2011 at 15:45 UTC | |
output As you can see, the To key holds an array ref. Which is, apparently, what Mail::Sender requires. If the output is indeed as you expect I would consider a second test script which just sends a dummy email to those email addresses. This approach has many advantages. You take on one problem at a time (which is my top limit :-) and you end up with a collection of subs you are confident with. Also, if you hit a particular snag with one of the subs you have a simple script that you can post here and which monks can download and run. This approach, in my experience, will result in a lot more help and solutions. Try the script above. If it appears ok, write your test_send_email and see if that's ok. If there are still snags, you know where we live. :-) | [reply] [d/l] [select] |