1

Topic: Internal Mail relay

System: CentOS 5.8 64-bit
iRedmail 0.7.4 (LDAP)
iRedadmin Pro 1.6.4 LDAP

Could anybody please help me with the following:

I need to be able to send admin mails from several internal systems WITHOUT loggin in. Exemple:

I have a network 10.50.50.0-255

I have hosts with various OS such as Windows, Linux etc. Scripts written in Perl or windows powershell should send some administrative messages to an administrator mailbox. This should be done without beeing logged in. How can I set this up? Currently I get error messages as follows:

Mar 27 07:02:03 sedna postfix/smtpd[24214]: connect from unknown[10.50.50.10]
Mar 27 07:02:05 sedna postfix/smtpd[24214]: warning: unknown[10.50.50.10]: SASL login authentication failed: UGFzc3dvcmQ6
Mar 27 07:02:05 sedna postfix/smtpd[24214]: NOQUEUE: reject: RCPT from unknown[10.50.50.10]: 553 5.7.1 <abc@xyz.com>: Sender address rejected: not logged in; from=<abc@xyz.com> to=<cdf@anotherdomain.com> proto=ESMTP helo=<GALAXY>
Mar 27 07:02:05 sedna postfix/smtpd[24214]: lost connection after RCPT from unknown[10.50.50.10]
Mar 27 07:02:05 sedna postfix/smtpd[24214]: disconnect from unknown[10.50.50.10]

(Names and hosts replaced with nonsense names)

In the above exemple abc@xyz.com should be able send an email using iRedMail server to cdf@anotherdomain.com WITHOUT being logged in. Using POWERSHELL this is a simple script as follows:

param( 
        [string] $From = "abc@xyz.com",
        [string] $To = "cdf@anotherdomain.com",
        [string] $Title = "title",
        [string] $Body = "body"
    )
    $SmtpClient = New-Object System.Net.Mail.SmtpClient("myhost.xyz.com", 25);
    $SmtpClient.Send($From,$To,$Title,$Body)

Relaying MUST ONLY WORK for INTERNAL mails, e.g. all mails sent from hosts with IP 10.50.50.*

How can I set this up in iRedMail ??

Many thanks
Thomas

2

Re: Internal Mail relay

Adding your internal IP addresses in Postfix setting 'mynetworks' will work for you.

3

Re: Internal Mail relay

Hi Zhang

ZhangHuangbin wrote:

Adding your internal IP addresses in Postfix setting 'mynetworks' will work for you.

I tried that but it does not work. Probably I'm doing something wrong. I changed in main.cf

mynetworks = 128.0.0.1/8  to mynetworks = 10.50.50.0/24

The rest I did not touch.

When tying to send email from a powershell script on windows host with address 10.50.50.10 I get the following error message:

Exception calling "Send" with "4" argument(s): "Mailbox name not allowed. The
erver response was: 5.7.1 <admin@tkmb.ch>: Sender address rejected: not logged
in"
At D:\Admin\SendMail.ps1:11 char:21
+     $SmtpClient.Send <<<< ($From,$To,$Title,$Body)
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException


So it seems that I still need to login! I can pass credentials but that does not help at all.

What am I missing?

Thanks for your support.
Thomas

4

Re: Internal Mail relay

tomb wrote:

mynetworks = 128.0.0.1/8  to mynetworks = 10.50.50.0/24

Try below setting:

mynetworks = 127.0.0.0/8, 10.50.50.10

Restarting Postfix service is required.

5

Re: Internal Mail relay

ZhangHuangbin wrote:
tomb wrote:

mynetworks = 128.0.0.1/8  to mynetworks = 10.50.50.0/24

Try below setting:

mynetworks = 127.0.0.0/8, 10.50.50.10

Restarting Postfix service is required.

Sorry, still the same problem! I did restart the server: service postfix restart
start and stop were confirmed with OK

Any idea?

Thoma<s

6

Re: Internal Mail relay

OK got it working now. The correct syntax requires CIDR and it seems, that every single address needs to be listed. So in the above exemple the correct configuration would be:

mynetworks = 127.0.0.0/8, 10.50.50.10/32, 10.50.50.11/32

7

Re: Internal Mail relay

tomb wrote:

mynetworks = 127.0.0.0/8, 10.50.50.10/32, 10.50.50.11/32

Did you try:

mynetworks = 127.0.0.0/8, 10.50.50.0/32