# Sending system mail to an external address



## t0ken (Nov 23, 2010)

I'm not sure if this is in the correct place, so please move it if not.

I'd like to have my system messages sent to an external address.  I've aliased 'root' corrected in /etc/aliases and ran newaliases as usual.

I test this by running
[cmd=]mail -s "test mail" root < /dev/null[/cmd]

The problem I'm running into is that the sendmail mta is setting the 'from' address as the hostname, causing my external account (which is running on gmail servers) to refuse the connection.  Here is the log (actual "to=" & "ctladd" changed):

```
Nov 23 00:50:12 daemon sm-mta[25448]: oAN6oCtx025447: to=andre @ gmail.address.tld, ctladdr=<root @ localhost.domain.tld> (0/0), 
delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=30644, relay=aspmx.l.google.com. [74.125.95.27], dsn=4.0.0, stat=Deferred: Connection 
refused by aspmx.l.google.com.
```

Any ideas how I can get around this?  I thought about configuring the sendmail from address, but I'm at a loss about how to do this on FreeBSD and google hasn't been too fruitful.


----------



## Galactic_Dominator (Nov 23, 2010)

t0ken said:
			
		

> The problem I'm running into is that the sendmail mta is setting the 'from' address as the hostname, causing my external account (which is running on gmail servers) to refuse the connection.



That's not the cause, think about it for a second.  How can google know what your from address is when the connection is refused.

I've done it that way for years to my gmail account so you'll have to keep digging.


----------



## t0ken (Nov 23, 2010)

Galactic_Dominator said:
			
		

> That's not the cause, think about it for a second.  How can google know what your from address is when the connection is refused.
> 
> I've done it that way for years to my gmail account so you'll have to keep digging.



If I'm not mistaken, the gmail server checks the PTR record that my IP address points to, and references that against what my server announces itself as to the gmail server during the HELO.

What am I missing?  Keep in mind I've run an email server before and was able to send to gmail without a problem (yahoo was a bit more stringent).  The only thinkg I can think of is the "from" FQDN.


====EDIT=====
I believe I see where you're going.  Disregard the above.


----------



## t0ken (Nov 24, 2010)

Ok I thought I'd figured this out but apparently it's still not working.  (I had setup ssmtp).

Can someone please point me in the right direction? (re: Sendmail forwarding root mail to a gmail account)


----------



## robbak (Nov 24, 2010)

have you done the sort of things listed in the post below? This is the setup I am using to get cron results sent to a gmail address.

http://www.daemonforums.org/showthread.php?t=20&highlight=mail+send-pr

(Yes, it's my post at daemonforums, originally from the defunct bsdforums.


----------



## t0ken (Nov 25, 2010)

robbak said:
			
		

> have you done the sort of things listed in the post below? This is the setup I am using to get cron results sent to a gmail address.
> 
> http://www.daemonforums.org/showthread.php?t=20&highlight=mail+send-pr
> 
> (Yes, it's my post at daemonforums, originally from the defunct bsdforums.



Thanks for that information.  Sendmail now connects to my ISP's smtp server, but I get a 
	
	



```
530:Authentication required
```
 error.  I've tried setting up my /etc/mail/access file, but for some reason I still get the exact same 
	
	



```
authentication required
```
 error message from my ISP's smtp server.

What's crazy is that in the past I've been able to send to gmail from this [residential] location without using a relay in the past.

I feel like I'm so close, yet, so far. =/

Thanks anyways for the help, I suppose I'll keep fiddling with it.


----------



## aragon (Nov 25, 2010)

mail/ssmtp supports authentication:


```
authuser=<username>
authpass=<password>
```

And if your ISP supports it, I recommend:


```
authmethod=cram-md5
```


----------



## t0ken (Nov 26, 2010)

Thanks aragon.  I meant to update this, I've gotten postfix to work using SASL.  I also had to set some things up with my ISP (att/yahoo) to allow relaying.

Thanks everyone for the help and suggestions.


----------

