Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Creating a no-reply email address
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
dejima
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jul 2004
Posts: 130
Location: Greece

PostPosted: Thu Aug 09, 2012 3:27 pm    Post subject: Creating a no-reply email address Reply with quote

I am building an application(PHP based) more like a social media that users would be sending messages and invites using the application's internal mail system.

The application is running on the Web Server which is located on a different server than our mail server. I would like to create an email address like no-reply@domain.com I would like this user to be able to send emails to users but did not want to receive any replies to the email. The php application would authenticate to the SMTP server(authentication is required)of our mail server and send the email to users but it should not receive replies.

How should I accomplish it? How would you approach this case?

I would also like to mention that I use Postfix and Dovecot on my mail server.

Thank you.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9679
Location: almost Mile High in the USA

PostPosted: Thu Aug 09, 2012 3:52 pm    Post subject: Reply with quote

What do you mean "no reply"?

Easiest way is to just delete all emails as they come in. They can send but you never need to reply... I don't see a problem with this?

Other ways:

Set up a "vacation" script that deletes all mails as they come in and optionally send something back.

Set up a mail quota of 0 on the user or set the mail directory to something unreadable and unwritable by the user and delivery agent. This depends on the local mail delivery system (I'm not familiar with postfix...)

Lie about your email address when sending - have no mail account ... This depends on the mail "client" (php script). Yes this is virtually "spam" but if you don't want people replying, isn't this the same as spam for all intents and purposes?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
dejima
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jul 2004
Posts: 130
Location: Greece

PostPosted: Thu Aug 09, 2012 4:27 pm    Post subject: Reply with quote

I believe that you can put the on the /etc/aliases if this is set up as your alias_maps on postfix an entry
Code:
devnull: /dev/null

and then on the /etc/postfix/virtual if this is configured as your virtual_alias_maps an entry
Code:
no-reply@domain.com devnull


My question is whether this no-reply user must be created as local user since I want my php application to use that user for authenticating to my SMTP server and send the emails.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Thu Aug 09, 2012 4:48 pm    Post subject: Reply with quote

dejima ...

First I would assume you want to setup a relay from the webserver to mailsever ... the webserver postfix doesn't recieve but forwards outgoing mail to relayhost. In which case you would do something like the following:

/etc/postfix/main.cf
Code:
inet_interfaces = loopback-only
append_dot_mydomain = no
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/relay_host
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/saslpass
smtp_tls_policy_maps = hash:/etc/postfix/tls_policy
smtp_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtp_tls_CApath = /etc/ssl/certs

/etc/postfix/relay_host
Code:
no-reply@domain.com [mail.domain.com]:587

/etc/postfix/tls_policy
Code:
mail.domain.com:587 encrypt

/etc/postfix/saslpass
Code:
no-reply@domain.com no-reply@domain.com:PASSWORD

Generate the hashes for the above files ...

Code:
# postmap /etc/postfix/sender_relay
# postmap /etc/postfix/saslpass
# postmap /etc/postfix/tls_policy

Next on the mailhost create a no-reply account and the relevant alias to send any mail delivered to /dev/null ...

Code:
# useradd -M -s /bin/false -p PASSWORD no-reply

/etc/postfix/main.cf
Code:
virtual_alias_maps = hash:/etc/postfix/virtual

/etc/aliases
Code:
devnull: /dev/null

/etc/postfix/virtual
Code:
no-reply@domain.com devnull@localhost

Create a hash of the virtual and aliases files ...
Code:
# postmap /etc/postfix/virtual
# newaliases

Reload postfix ..
Code:
/etc/init.d/postfix reload

So, mail To: no-reply should end up in /dev/null but mail from that account should be passed on to the recipient. Untested, but it should work.

HTH & best ... khay


Last edited by khayyam on Thu Aug 09, 2012 5:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
dejima
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jul 2004
Posts: 130
Location: Greece

PostPosted: Thu Aug 09, 2012 4:57 pm    Post subject: Reply with quote

khayyam wrote:
dejima ...

First I would assume you want to setup a relay from the webserver to mailsever ... the webserver postfix doesn't recieve but forwards local mail to relayhost. In which case you would do something like the following:

/etc/postfix/main.cf
Code:
inet_interfaces = loopback-only
append_dot_mydomain = no
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/relay_host
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/saslpass
smtp_tls_policy_maps = hash:/etc/postfix/tls_policy
smtp_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtp_tls_CApath = /etc/ssl/certs

/etc/postfix/relay_host
Code:
no-reply@domain.com [mail.domain.com]:587

/etc/postfix/tls_policy
Code:
mail.domain.com:587 encrypt

/etc/postfix/saslpass
Code:
no-reply@domain.com no-reply@domain.com:PASSWORD

Generate the hashes for the above files ...

Code:
# postmap /etc/postfix/sender_relay
# postmap /etc/postfix/saslpass
# postmap /etc/postfix/tls_policy

Next on the mailhost create a no-reply account and the relevant alias to send any mail delivered to /dev/null ...

Code:
# useradd -M -s /bin/false -p PASSWORD no-reply

/etc/postfix/main.cf
Code:
virtual_alias_maps = hash:/etc/postfix/virtual

/etc/aliases
Code:
devnull: /dev/null

/etc/postfix/virtual
Code:
no-reply@domain.com devnull@localhost

Create a hash of the virtual and aliases files ...
Code:
# postmap /etc/postfix/virtual
# newaliases

Reload postfix ..
Code:
/etc/init.d/postfix reload

So, mail To: no-reply should end up in /dev/null but mail from that account should be passed on to the recipient. Untested, but it should work.

HTH & best ... khay


Thank you khayyam

To tell you the truth I don't think there is a need for me to to the first steps on the web server since php code will be the one that will take care of that, or do I?
But on the part what is needed to be done on the mailhost you are right.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Thu Aug 09, 2012 5:12 pm    Post subject: Reply with quote

dejima wrote:
To tell you the truth I don't think there is a need for me to to the first steps on the web server since php code will be the one that will take care of that, or do I? But on the part what is needed to be done on the mailhost you are right.

dejima ... your welcome ...

I would use the postfix relay as smtp is smtp and so its the right tool, I also have less trust of world facing php scripts, and with the relay to can do the following if there is some problem ...

Code:
# /usr/sbin/postconf 'defer_transports = smtp'
# /etc/init.d/postfix reload

and all mail is held ... until issuing:

Code:
# /usr/sbin/postconf 'defer_transports ='
# /etc/init.d/postfix reload
# /usr/sbin/postfix flush

You can even remove all mail in the que (see man mailq)

best ... khay
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Sat Aug 11, 2012 9:34 am    Post subject: Reply with quote

i fear i may be late inasmuch as you seem to already have this covered off but:

dejima wrote:

My question is whether this no-reply user must be created as local user since I want my php application to use that user for authenticating to my SMTP server and send the emails.


created locally on the web server, or mail server?

on the web server: unlikely, as i doubt your php script particularly cares about local users on the web server.
on the mail server: depends on what your auth backend is. If the ESMTP auth is done against your local users, then yes, you'd have to add that user. If it's done against say, sasldb2, then no. If it's done against a database, again, no. The user has to be added to whichever backend auth DB you're using, but unless that happens to be your local shadow users, adding the smtp account as a local is unnecessary, and a mailbox isn't required either way. But, authing and sending out says nothing with regards to how a mail should be treated when it comes *in*. So in essence, yes, sending to /dev/null would work, regardless of whether or not your auth backend looks at local users.

HTH
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum