Here's perl I use:

use Net::SMTP;
  my $to = "someu...@mydomain.com";
  my $from = "someb...@somedomain.com";
  my $subject = "test message subject";
  my $message = "some message body";
  #Create a new object with 'new'.
  $smtp = Net::SMTP->new("localhost");
  $smtp->mail($from);
  $smtp->to($to);
  #Start the message.
  $smtp->data();
  $smtp->datasend("To: $to\n");
  $smtp->datasend("From: $from\n");
  $smtp->datasend("Subject: $subject\n");
  $smtp->datasend("\n"); # done with header
  $smtp->datasend($message);
  #End the message.
  $smtp->dataend();
  #Close the connection to your server.
  $smtp->quit();


On Wed, Feb 20, 2013 at 5:23 PM, Zach Cox <zcox...@gmail.com> wrote:

> Hi - I'm doing some work with Apache James and have it running on my local
> development machine, which runs Ubuntu. To simplify testing, I'd like to be
> able to send an email to this local James server from a bash script.
>
> I know I can telnet localhost 25 and send it that way, but telnet is
> difficult from a script. I've tried using msmtp and that gets the email
> into James, but JavaMail is unable to parse the data as a MimeMessage.
>
> I'd like to just find a simple command-line email utility that can send a
> well-formed email to my localhost server, without hitting dns or anything.
>
> Does anyone have any good suggestions for doing this?
>
> Thanks,
> Zach
>



-- 
Barry Lai
Software Engineer, Abine

Reply via email to