# configure sendmail - (only for sending mail through smtp)

## hothead

Hi, 

Since I benefit from all the people that feed freedb.org with cd information I do want to 

help in this process - unfortunately the complexity of sendmail bars me from doing so.

I do have a mail account that needs authentification (similar to web.de). 

Would you be so kind to help me in configuring sendmail to simply send mail through smtp?

Thanks for your help.

Regards 

Ruben

----------

## papal_authority

Sure. Create an /etc/mail/sendmail.mc similar to this (replacing mail.myisp.net with your ISP's mail server and myisp.net with your ISP's domain):

```
OSTYPE(`linux')

define(`SMART_HOST', `esmtp:mail.myisp.net')dnl

undefine(`confTO_QUEUERETURN')dnl

undefine(`confTO_QUEUEWARN')dnl

FEATURE(`masquerade_envelope')dnl

FEATURE(`access_db', `hash /etc/mail/access')dnl

MASQUERADE_AS(`myisp.net')dnl

MAILER(`smtp')dnl
```

Then run this command:

```
m4 /usr/share/sendmail-cf/m4/cf.m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
```

and start sendmail:

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

----------

## hothead

Thanks for the quick answer. But unfortenately it doesn't work at first go.

First two questions:

My ISP's mail server is 'mail.arcor.de' - so ISP domain should be 'arcor.de'  - Right?

Where do I have to put the password and the username ? - ISP needs authentification before sending.

(I need to configure every mail-client (kmail, thunderbird) that way)

Sendmail takes quite a long time to start up: 

```
root@workstation [/home/ruben] time /etc/init.d/sendmail start

 * Starting sendmail ...                                                                                                            [ ok ]

real    1m20.787s

user    0m0.177s

sys     0m0.084s

```

Messages say the following:

```
Sep  5 21:22:05 workstation sm-cm[15169]: starting daemon (8.13.4): queueing@00:30:00

Sep  5 21:22:05 workstation sm-cm[15170]: j85Iwcsm030309: to=ruben, delay=00:23:26, xdelay=00:00:00, mailer=relay, pri=212142, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

Sep  5 21:22:05 workstation sm-cm[15170]: j85DDsXV011767: to=freedb-submit@freedb.org, ctladdr=ruben (1000/100), delay=06:08:11, xdelay=00:00:00, mailer=relay, pri=300867, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

Sep  5 21:22:55 workstation sendmail[16012]: gethostbyaddr(192.168.1.11) failed: 2

Sep  5 21:22:55 workstation sendmail[16012]: alias database /etc/mail/aliases rebuilt by ruben

Sep  5 21:22:55 workstation sendmail[16012]: /etc/mail/aliases: 21 aliases, longest 10 bytes, 221 bytes total

Sep  5 21:23:36 workstation sm-mta[17108]: gethostbyaddr(192.168.1.11) failed: 2

Sep  5 21:23:36 workstation sm-mta[17108]: sql_select option missing

Sep  5 21:23:36 workstation sm-mta[17108]: auxpropfunc error no mechanism available

Sep  5 21:23:36 workstation sm-mta[17108]: _sasl_plugin_load failed on sasl_auxprop_plug_init for plugin: sql

Sep  5 21:23:36 workstation sm-mta[20199]: starting daemon (8.13.4): SMTP+queueing@00:30:00

Sep  5 21:23:36 workstation sm-cm[20202]: starting daemon (8.13.4): queueing@00:30:00

Sep  5 21:23:36 workstation sm-mta[20204]: j85JNabZ020204: SYSERR(root): hash map "access": missing map file /etc/mail/access.db: No such file or directory

Sep  5 21:23:36 workstation sm-mta[20204]: ruleset=check_relay, arg1=workstation.homelinux.pc, arg2=127.0.0.1, relay=workstation.homelinux.pc [127.0.0.1], reject=451 4.3.0 Temporary system failure. Please try again later.

Sep  5 21:23:36 workstation sm-cm[20203]: j85Iwcsm030309: to=ruben, delay=00:24:57, xdelay=00:00:00, mailer=relay, pri=302142, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: 451 4.3.0 Temporary system failure. Please try again later.

Sep  5 21:23:36 workstation sm-cm[20203]: j85DDsXV011767: to=freedb-submit@freedb.org, ctladdr=ruben (1000/100), delay=06:09:42, xdelay=00:00:00, mailer=relay, pri=390867, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: 451 4.3.0 Temporary system failure. Please try again later.
```

----------

## papal_authority

Ah I didn't know that part  :Smile: 

You'll need to add the following to your sendmail.mc file:

```
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
```

There's a bit more to it, not much though, just defining your login and password. There's a really good step-by-step HOWTO that guides you through this (scroll down to the heading that says "Using sendmail as a client with AUTH". HTH.

----------

## hothead

I followed the step by step howto but unfortunately it doesn't work anyway.

```
Sep  5 23:26:24 workstation sm-mta[23139]: gethostbyaddr(192.168.1.11) failed: 2

Sep  5 23:26:24 workstation sm-cm[23157]: starting daemon (8.13.4): queueing@00:30:00

Sep  5 23:26:24 workstation sm-cm[23158]: j85Iwcsm030309: to=ruben, delay=02:27:45, xdelay=00:00:00, mailer=relay, pri=842142, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

Sep  5 23:26:24 workstation sm-cm[23158]: j85DDsXV011767: to=freedb-submit@freedb.org, ctladdr=ruben (1000/100), delay=08:12:30, xdelay=00:00:00, mailer=relay, pri=930867, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

```

Anny Suggestion?

Regards 

Ruben

----------

## Pete M

As of sendmail 8.12 you don't need

 *Quote:*   

> FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl

 

Authinfo is built into sendmail.cf

All you need to do is add

```
AuthInfo:smtp.myisp.com "U:smmsp" "I:username" "P:password"
```

To /etc/mail/access

Where

smtp.myisp.com is your ISP mail server

Leave "U:smmsp" as is

"I:username" replace username with your own

"P:password" replace password with your own

On the command line as root run

```
# makemap hash /etc/mail/access.db < /etc/mail/access
```

To generate /etc/mail/access.db

Restart sendmail

Pete

----------

## hothead

Thanks Pete. That helps.

Sending the cddb information via grip works now. But I cannot send myself a testmail. I tried:

```

echo "abc" | sendmail mailaddress@arcor.de

 
```

Acording to another sendmail thread in the forums, that should work. Anny Suggestion?

It also seems that sending the mail takes some time. Is there a way to speed up the sending process? 

Many thanks for all your help!!

Regards 

Ruben

----------

## Pete M

Ruben

Can you post me the contents of your /etc/mail/sendmail.mc and your /etc/mail/submit.mc

Plus the contents of your /etc/mail/ directory

```
root# ls -a -l /etc/mail
```

Pete

----------

## hothead

Content in 'sendmail.mc' are the default settings. ( I've nothing changed in there).

There is no 'submit.mc' in /etc/mail.

ls -l /etc/mail

```

-rw-------  1 root root   276  6. Sep 00:18 access

-rw-r-----  1 root root 12288  6. Sep 00:24 access.db

-r--r--r--  1 root root  5588  5. Sep 23:01 helpfile

-rw-r--r--  1 root root    63  5. Sep 23:01 local-host-names

-rw-r--r--  1 root root 40996  6. Sep 00:23 sendmail.cf

-rw-r--r--  1 root root   357  6. Sep 00:18 sendmail.mc

-rw-------  1 root root   728  6. Sep 06:27 statistics

-r--r--r--  1 root root 41137  5. Sep 23:01 submit.cf

-rw-r--r--  1 root root   126  5. Sep 23:01 trusted-users

```

cat sendmail.mc

```

divert(-1)

divert(0)dnl

include(`/usr/share/sendmail-cf/m4/cf.m4')dnl

VERSIONID(`$Id: sendmail-procmail.mc,v 1.2 2004/12/07 01:59:31 g2boojum Exp $')dnl

OSTYPE(linux)dnl

DOMAIN(generic)dnl

FEATURE(`smrsh',`/usr/sbin/smrsh')dnl

FEATURE(`local_lmtp',`/usr/sbin/mail.local')dnl

FEATURE(`local_procmail')dnl

MAILER(local)dnl

MAILER(smtp)dnl

MAILER(procmail)dnl

```

----------

## Pete M

Hi Ruben

papal_authority advised you to make lots of changes to sendmail.mc, just wanted to check your configuration files

To send mail from the command line use

```
echo "abc" | /usr/lib/sendmail mailaddress@arcor.de
```

Pete

----------

## hothead

Hi,

Finally I got sendmail starting up quickly. It seems to have resolving problems. After adding IP number of the NIC that's connected to the internet and hostname to /etc/hosts startup works fine.

But it seems that sendmail seems to be very fussy. With sendmail I'm not able to send mails to several german freemail providers (web.de gmx.de arcor.de). I read that sendmail is somehow blocked by them - Topic (german).

Can someone confirm this behaviour - or is the reason my special configuration?

Sendmail also fails when I try to send mail from kbugbuster with sendmail:

```
Sep  7 14:56:17 workstation sendmail[10839]: j87CuGGe010839: to=102873@bugs.kde.org, ctladdr=ruben (1000/100), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30331, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (j87CuHYA010840 Message accepted for delivery)

Sep  7 14:56:20 workstation sm-mta[10842]: j87CuHYA010840: to=<102873@bugs.kde.org>, ctladdr=<ruben@workstation.homelinux.pc> (1000/100), delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=120572, relay=bugs.kde.org. [131.246.103.200], dsn=5.6.0, stat=Data format error

Sep  7 14:56:20 workstation sm-mta[10842]: j87CuHYA010840: j87CuKYA010842: DSN: Data format error

Sep  7 14:56:20 workstation sm-mta[10842]: j87CuKYA010842: to=<ruben@workstation.homelinux.pc>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31817, dsn=2.0.0, stat=Sent

```

Regards 

Ruben

----------

