Hi together,
does anybody know how to send an email from vma?
i don't find the command "mail".
Thanks
Timm
vMA is a pretty stripped down Linux OS, having said that, it's just LINUX. You can easily install additional packages such as a mail client, one is not included by default.
I've sent mail using Net::SMTP Perl module and you can find many examples on the web or install your own perferred mail client.
Hi
Unfortunately I don't think there is a way to send emails via the vma. I've just had a look through my VMA guide and there is no mention of SMTP settings or mail to that matter either. You can send mails via PowerCLI though as another path you could take?
Gregg
vMA is a pretty stripped down Linux OS, having said that, it's just LINUX. You can easily install additional packages such as a mail client, one is not included by default.
I've sent mail using Net::SMTP Perl module and you can find many examples on the web or install your own perferred mail client.
By default, on my VMA (5.0.0.0 Build 472630), I can install mailx from the stock opensuse repository. I found it through zypper:
And to verify this worked and showed up in my inbox:
echo "asdfasdf" | mail gettyless@xxxxx.com
Jan 5 22:39:30 vma1 sendmail[30048]: q05MdRq0030046: to=<gettyless@xxxxx.com>, ctladdr=<root@vma1.xxxxxx.com> (0/0), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=120476, relay=xxxx.xxxxx.com. [10.10.10.19], dsn=2.0.0, stat=Sent (q05MfMq9003386 Message accepted for delivery)
^C
Update: Apparently, I downloaded an old version of vMA, so this is for vMA 4. I'm working on vMA 5 right now...
I ran into this same problem. None of my VMs have network-accessable SMTP servers, so my vMA VM needs to send directly to the recipient's server, which should be fine in most cases. First I tried looking for sendmail, postfix, sendEmail and other lightweight SMTP applications, but there aren't any. They either require an SMTP relay to talk to, or require lots of RPMs, or RPMs I wasn't able to find easily. The RHEL release that vMA 5 is built upon is spectacularly old, so I had to hunt around for RPMs. I won't say this is the best solution, but it does work. This is what I did:
1. SSH into the vMA VM (I used WinSCP).
2. Get the following RPMs and transfer them over:
perl-IO-Socket-SSL-1.44-1.el5.rfx.noarch.rpm
perl-Net-SMTP-SSL-1.01-1.el5.rf.noarch.rpm
perl-Net-SSLeay-1.36-1.el5.rfx.x86_64.rpm
I got mine from "random" sites (e.g. http://pkgs.repoforge.org/perl-Net-SSLeay/)
3. Install them all via sudo rpm -i *rpm
4. Create a Perl script to send mail. This is probably my third Perl script ever written. It has no error checking, and generally shouldn't be used, but it does work under perfect conditions. I intentionally broke it, so you'll have to uncomment and modify one line for it to work:
#!/usr/bin/perl -w
use strict;
use Getopt::Std;
use Net::SMTP;
my %options = ();
getopts("d:f:s:", \%options);
my @tmp = split(/@/, $options{f});
my $destinationDomain = $tmp[1];
my @mxServers = `dig +short mx $destinationDomain | sort -n | awk '{print \$2}'`;
my $mxServer = $mxServers[0];
chomp(@mxServers);
chop(@mxServers);
my $mxServer = $mxServers[0];
#my $smtp = Net::SMTP->new($mxServer, Debug => 1) || die "Error: $!";
$smtp->mail($options{f});
$smtp->recipient($options{d});
$smtp->data;
$smtp->datasend("From: $options{f}\n");
$smtp->datasend("To: $options{d}\n");
$smtp->datasend("Subject: $options{s}\n");
$smtp->datasend("\n");
while (defined(my $line = <STDIN>)) {
$smtp->datasend($line);
}
$smtp->dataend;
$smtp->quit;
Good luck!
Josh
Josh - very interested to see if you have managed to get email to work in vMA 5? I have tried sendEmail and ssmtp in 5 but no joy so far. Thanks.