LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-23-2013, 06:50 PM   #1
DerAlex23
LQ Newbie
 
Registered: Mar 2013
Posts: 4

Rep: Reputation: Disabled
Mail forwarding with sendmail


Hey,
I am new to linux. I have a problem:
I have a webserver which runs Apache and php (I am hosting a forum and got an own domain). It has also sendmail installed for sending emails via php. Now I want to set up a mail forwarding service, so if someone write an email to a address of mz domain, I want that this mail is redirected to another email assress, example:
My domain is asdf.com
Someone send a mail to Alex@asdf.com. my server fetch the email and look up (in a file) if Alex@asdf.com is an alias. If there is a address like Alex@outlook.com asdigmned to Alex@asdf.com, hen the mail should be forwarded to Alex@outlook.com.
On another server I already solved this with postfix and alias/virtual... But in this case I need send mail for php (and I can not install both at the same time).
Have anyone an idea?
 
Old 03-24-2013, 04:18 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Hi,

Since your domain is asdf.com, you can use /etc/aliases (or /etc/mail/aliases depending on distro). Edit the file and add a line like:
Code:
Alex: Alex@outlook.com
After that you need to run:
Code:
newaliases
for the changes to take effect.

Regards
 
Old 03-26-2013, 04:30 PM   #3
DerAlex23
LQ Newbie
 
Registered: Mar 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks for your quick answer. I edited the aliases and sent a test mail Alex@asdf.com but it says "Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server."

Do I need to configure the MTA?
 
Old 03-27-2013, 01:34 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Quote:
Originally Posted by DerAlex23 View Post
Thanks for your quick answer. I edited the aliases and sent a test mail Alex@asdf.com but it says "Unable to deliver message to the following recipients, due to being unable to connect successfully to the destination mail server."

Do I need to configure the MTA?
Have a look at the logs (/var/log/maillog usually) to see what's happening.
Perhaps you don't have a valid PTR record for the IP of your mailserver.
Or you may need to configure spf and/or dkim, as outlook.com (aka hotmail.com) is a bit strict on these things. If it's possible, try to forward the email to a gmail address to see if that's the case.

Regards
 
Old 04-08-2013, 03:32 PM   #5
DerAlex23
LQ Newbie
 
Registered: Mar 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
I tried to send a mail from another server via php-mail-function. Then I checked the mail.log on this server:

Apr 8 20:13:16 euve20858 postfix/smtp[23617]: connect to asdf.de[85.214.91.37]:25: Connection refused

Apr 8 20:13:16 euve20858 postfix/smtp[23617]: 76C7D9939150: to=<alex@asdf.de>, relay=none, delay=1100, delays=1100/0.01/0.38/0, dsn=4.4.1, status=deferred (connect to asdf.de[85.214.91.37]:25: Connection refused)


I checked if the service is up:
alex@h1828827:/var/log$ sudo netstat -tulpn | grep :25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 12553/sendmail: MTA


I neither can connect to port 25 via telnet. Could it be firewall problem?
 
Old 04-08-2013, 06:04 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
Could well be firewall.
Please add your distro name+version to your profile, so we can help you better.
You can get it from
Code:
cat /etc/*release*


# This will confirm it and whether its 32 or 64 bit
uname -a
If its a RHEL (or derived OS eg Centos)
Code:
service iptables status
or try
Code:
iptables -nvL
 
Old 04-09-2013, 12:28 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Quote:
alex@h1828827:/var/log$ sudo netstat -tulpn | grep :25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 12553/sendmail: MTA
There could be a firewalll also, but in a first place note that sendmail listens only on the local loopback interface
Because of this you cannot connect to it from another box. Have a look here to see what you can do.

Regards
 
Old 04-10-2013, 03:54 PM   #8
DerAlex23
LQ Newbie
 
Registered: Mar 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
There could be a firewalll also, but in a first place note that sendmail listens only on the local loopback interface
Because of this you cannot connect to it from another box. Have a look here to see what you can do.

Regards
Thanks,
that was one of my problems ;D

now i can send mails to the server, but in my mail.log another error occured:
Code:
Apr 10 22:46:29 h1828822 sm-mta[24882]: r3AKkSul024882: ruleset=check_rcpt, arg1=<alex@asdf.de>, relay=euve20858.vserver.de [62.75.171.51], reject=553 5.5.4 <alex@asdf.de>... Domain name required for sender address www-data
I read something about adding my domain name to my /etc/hosts, but I thought i should ask before i edit this file...
my current content is:
Code:
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

# Auto-generated hostname. Please do not remove this comment.
85.214.91.37 h1828822.stratoserver.net h1828822
kind regards
 
Old 04-11-2013, 02:13 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Quote:
Apr 10 22:46:29 h1828822 sm-mta[24882]: r3AKkSul024882: ruleset=check_rcpt, arg1=<alex@asdf.de>, relay=euve20858.vserver.de [62.75.171.51], reject=553 5.5.4 <alex@asdf.de>... Domain name required for sender address www-data
You need to either configure your app, to send out mails using a legitimate email address, or you should use genericstable in sendmail. Don't forget to make backups before editing the sendmail.mc file

Regards
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail forwarding using Sendmail yunus.raza Linux - Software 4 04-19-2008 01:44 AM
Configuring sendmail for mail forwarding to server Yalla-One Slackware 16 11-02-2007 06:27 PM
Mail Forwarding in postfix/maildrop/redhat (like yahoo mail forwarding) topcat Linux - Software 1 08-31-2007 12:10 PM
Sendmail second server/mail forwarding? WorldBuilder Linux - Networking 4 03-11-2004 06:10 PM
mail forwarding problem with sendmail JelloMaster Linux - Software 18 08-14-2003 09:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration