# [solved] ssmtp - not so simple

## bendeguz

Hi!

Anyone can send mail, with ssmtp?

I really don't know what's the problem with my setup. I tried my ISP's smtp and now I'm trying with gmail's smtp with the same result:

/val/log/mail.err

```

Jun 12 01:24:12 localhost sSMTP[29920]: Unable to locate mailhub

Jun 12 01:24:12 localhost sSMTP[29920]: Cannot open mailhub:25

```

```

#

# /etc/ssmtp.conf -- a config file for sSMTP sendmail.

#

# The person who gets all mail for userids < 1000

# Make this empty to disable rewriting.

# root=my@email.com

# The place where the mail goes. The actual machine name is required

# no MX records are consulted. Commonly mailhosts are named mail.domain.com

# The example will fit if you are in domain.com and your mailhub is so named.

# Example for SMTP port number 2525

# mailhub=mail.your.domain:2525

# Example for SMTP port number 25 (Standard/RFC)

 mailhub=smtp.gmail.com:587

# Example for SSL encrypted connection

# mailhub=mail.your.domain:465

# Where will the mail seem to come from?

rewriteDomain=smtp.gmail.com

# The full hostname

# Gentoo bug #47562

# Commenting the following line will force ssmtp to figure

# out the hostname itself.

# hostname=_HOSTNAME_

hostname=smtp.gmail.com:587

# Set this to never rewrite the "From:" line (unless not given) and to

# use that address in the "from line" of the envelope.

FromLineOverride=YES

# Use SSL/TLS to send secure messages to server.

UseTLS=YES

UseSTARTTLS=Yes

# Use SSL/TLS certificate to authenticate against smtp host.

#UseTLSCert=YES

# Use this RSA certificate.

#TLSCert=/etc/ssl/certs/ssmtp.pem

# Get enhanced (*really* enhanced) debugging information in the logs

# If you want to have debugging of the config file parsing, move this option

# to the top of the config file and uncomment

#Debug=YES

```

```

ls -l /etc/ssmtp

total 5

-rw-r--r--. 1 root root   200 May 25 10:25 revaliases

-rw-r-----. 1 root ssmtp 1449 Jun 12 01:33 ssmtp.conf

```

(revaliases file is empty)

my user is in the ssmtp group

I'm using this to send mail:

```

~ $ sendmail <recipient@email.com> -au <myaccount@gmail.com> -ap <mypassword>

```

Last edited by bendeguz on Sat Jun 12, 2010 12:53 pm; edited 1 time in total

----------

## cach0rr0

in your "mailhub" line there is a space before the first letter

maybe the line gets ignored because of that? no idea

I don't know if it's saying that it "can't locate" the mailhub setting in the configuration file, or if it's trying to resolve what you have in mailhub, and failing.

Also, unless you're sending *from* a gmail address (which, if you were, why not connect the client directly to gmail?) then do not use gmail's smtp servers. You will be blocked as an unauthorized relay. In the event you're sending to another gmail user, you will be blocked for being on a residential/dynamic IP. 

Use your ISP's smtp server.

----------

## bendeguz

 *cach0rr0 wrote:*   

> 
> 
> in your "mailhub" line there is a space before the first letter
> 
> maybe the line gets ignored because of that? no idea
> ...

 

OMG, you were right!  :Very Happy:  Now it's working with gmail. I still have some authentication problem with my ISP's stmp, but i don't care until it's working with gmail.

Thank you for your help!

----------

## bendeguz

I have one more problem:

How do you set your real name, when sending mail?

Doesn't work:

```

 sendmail recipient at email.com -au gmailuser -ap gmailpass -F realname

```

If I set it in ~./muttrc with "set realname" doesn't work either.

These set the gmail e-mail address instead of my name.

----------

