in reply to passing a hash to module function
References are good. Here's a working version - you should be able to figure it out from this:
#!/usr/bin/perl use strict; use warnings; use MIME::Lite; sendmail(\{to=>'koszta@seznam.cz', from=>'admin@server.com', data=>'hi + from server', subject=>'msg body'}); sub sendmail { my $param = shift; my $email= MIME::Lite->new( From=>"$$param->{'from'}", To=>"$$param->{'to'}", Subject=>"$$param->{'subject'}", Data=>"$$param->{'data'}" ); # debug output print "I would now send from $$param->{'from'} to $$param->{'t +o'}:\n"; print "Subject: $$param->{'subject'}\n\n"; print "$$param->{'data'}\n"; # disable sending as I'm only testing :-) # $email->send; }
|
|---|