A
a
Hi,
I am trying to use MIME::Lite to automate some testing cases.
This module requires the following to initialize the email.
my $msg = MIME::Lite->new(
To =>'(e-mail address removed)',
From =>'(e-mail address removed)',
Subject =>'Too Too Too Simple Email',
Data =>"TESTING"
);
I put all these information in an xml file as the following, and load the
file in a hash.
my $ref = XMLin("sample_email.xml");
my %h = %{$ref->{email}->[1]};
<config>
<email>
</email>
<email>
<from>[email protected]</from>
<to>[email protected]</to>
<subject>This is a simple email</subject>
<data>This is a very simple email</data>
</email>
</config>
Is there any way to put the hash in the MIME::Lite->new( <argument contained
in hash> ) to initialize it?
I have tried the following but not success
my $ref = XMLin("sample_email.xml");
my %h = %{$ref->{email}->[1]};
my $msg = MIME::Lite->new();
foreach (keys %h)
{
$msg->set($_=>$h{$_});
or
$msg->add($_=>$h{$_});
or
$msg->attr($_=>$h{$_});
}
I am trying to use MIME::Lite to automate some testing cases.
This module requires the following to initialize the email.
my $msg = MIME::Lite->new(
To =>'(e-mail address removed)',
From =>'(e-mail address removed)',
Subject =>'Too Too Too Simple Email',
Data =>"TESTING"
);
I put all these information in an xml file as the following, and load the
file in a hash.
my $ref = XMLin("sample_email.xml");
my %h = %{$ref->{email}->[1]};
<config>
<email>
</email>
<email>
<from>[email protected]</from>
<to>[email protected]</to>
<subject>This is a simple email</subject>
<data>This is a very simple email</data>
</email>
</config>
Is there any way to put the hash in the MIME::Lite->new( <argument contained
in hash> ) to initialize it?
I have tried the following but not success
my $ref = XMLin("sample_email.xml");
my %h = %{$ref->{email}->[1]};
my $msg = MIME::Lite->new();
foreach (keys %h)
{
$msg->set($_=>$h{$_});
or
$msg->add($_=>$h{$_});
or
$msg->attr($_=>$h{$_});
}