# Why does sendmail need a relay?

## dE_logics

Sendmail is "an electronic mail transport agent" as per the man page, so it should directly be able to communicate to other mail exchange servers to deliver mail.

But when I try to send mails to my Google account...

```
Connecting to [127.0.0.1] via relay...

Deferred: Connection refused by [127.0.0.1]
```

----------

## eccerr0r

how are you trying to send mail to your google account?  What mail client are you using?

Sendmail is a mail transport, though if you're just sending mail to another site, you don't need another transport agent...

----------

## dE_logics

 *eccerr0r wrote:*   

> how are you trying to send mail to your google account?  What mail client are you using?
> 
> Sendmail is a mail transport, though if you're just sending mail to another site, you don't need another transport agent...

 

sendmail -v my_ID@gmail.com

<message>

...

...

ctrl-D

Mail client? I thought sendmail works as a small mail client and also as a transfer agent. That's why I can compose mails using it in the 1st place.

----------

## eccerr0r

Technically "telnet" can also be used to send mail...

By the way, are you sure you're using sendmail and not ssmtp?  ssmtp may need a bit of configuration however.  I've never really used ssmtp so I don't know how it's used...

----------

## dE_logics

I've mail-mta/sendmail package installed

----------

## dataking

 *dE_logics wrote:*   

> I've mail-mta/sendmail package installed

 

Is it running?

Did you 

```
sudo /etc/init.d/sendmail start
```

 and/or 

```
rc-update add sendmail default
```

?

The latter wouldn't have started the service unless you rebooted after.

----------

## dE_logics

I didnt know about the daemon.

Thanks for that...

----------

## eccerr0r

Ah yeah that would explain why the relay isn't working...

But might want to look at ssmtp if you don't want to relay.  ssmtp will use another machine's relay.

----------

