# command line mail program [SOLVED - sendEmail]

## Aysen

Hi.

Can anyone recommend a command line program to send email (to work in a bash script)? I don't want to setup my own server or anything, I just need a program able to send mail using my existing address (SMTP server). I know about mail, but... erm, call me stupid, but I can't use it...  :Embarassed:  Or maybe configure something wrong... I have to setup sendmail correctly to be albo to use mail, right?  If that is the program I need, could I ask for any guidance what to do to be able to send mail from one address to another?

Thank you very much!Last edited by Aysen on Thu Oct 27, 2005 5:43 pm; edited 1 time in total

----------

## speak_see_hear

I *think* that mutt will do what you need.

----------

## think4urs11

net-mail/sendEmail

net-mail/email

----------

## Aysen

Thanks for such a quick reply!

sendEmail is *the* program I needed!

I knew about mutt, but it has a ncurses/slang interface and I needed one with no interface but command line. Anyway, thank you both!   :Very Happy: 

----------

## fourhead

I'm just trying sendEmail too, but it doesn't work. When I run it with

./sendEmail -f myadress@mydomain.de -t myrealmail@otherdomain.de -u Test -m Test

I get this:

```

ERROR => Connection attempt to localhost:25 failed: IO:Socket:INET: connect: Connection refused

```

This is actually an Ubuntu install, so it might be Ubuntu-specific. It's a default config, I have no firewall at all, and I don't have sendmail or any other mail stuff installed. Any ideas?

Tom

----------

## Aysen

 *fourhead wrote:*   

> I'm just trying sendEmail too, but it doesn't work. When I run it with
> 
> ./sendEmail -f myadress@mydomain.de -t myrealmail@otherdomain.de -u Test -m Test
> 
> I get this:
> ...

 

You need to supply the -s option (server:port). For example, if you use smtp.mydomain.de as your SMTP server, use 

```
sendEmail [your options] -s smtp.mydomain.de
```

 (the port is optional and defaults to 25).

Moreover, if your mail server requires authentication, you'll need to emerge the masked (~x86) version of sendEmail - the current stable version doesn't support it (at least it didn't work for me). The -xu and -xp options are responsible for authentication. For more info launch sendEmail with no arguments.

----------

## PaulBredbury

With mutt, the command would be:

```
echo "This is the body." | mutt -s "This is the Subject" -a /tmp/attachment.zip recipient@company.com
```

----------

## fourhead

Shame on me   :Embarassed: 

I didn't see the -s switch at all, but now it works, I'm using my own mail server with -xu and -xp. Thanks a lot!

Tom

----------

