Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

the web service sends out emails on behalf of the users to their customers. So john@domainA.com uses webservice and webservice sends emails . The emails should be appearing as coming from john@domainA.com.

Currently what we are trying to do is to configure webservice to act as an email client for each user, each user being able to create their own profile in which they need to configure their smtp server credentials. But given that there are more options for configurations than you can shake your stick at -not to mention trying to explain to users what info to get from where, POP b4 smtp, TLS, SSL, AUTH,etc) I am wondering if there could be a different way.

How, if at all could this be approached? Can I set up a postfix server to do what I need to without running into another admin. nightmare or being blocked for spamming?

Thank you for your insights

share|improve this question

3 Answers 3

No, not if the domain holder follows good security rules.

Problem:

Well maintained Domains have an SPF record stating exactly which servers are allowed to send email on behalf of the domain. Any other server (like yours) sending the email is automatically getting the email marked as spam.

Some idiot broker tried that with their contact form for me - lost my business as I could not even contact them ;) They used Gmail as their backend, and Google happily refused the email faking my origin as coming from an unauthorized server (and send me an error report about it).

if that is for known defined customers - then it is possible, but customers definitely should make sure they know about the SPF item. In this case "just do it". Some postfix person probably will gladly jump in to tell you about how to configure it. I wanted mostly to make sure you don't ignore the SPF side of that ;)

share|improve this answer
    
thanks for the response. The customers are known, not sure what you mean by defined. And could you elaborate what you think about with the "just do it" comment? Just do the relaying and see what happens? –  mic Mar 11 '10 at 10:28
    
"just do it" means "jus tconfigur ethe server". Defined means customers that decide to use your service and thus will reconfigure the domain, not customers "just sending an email", like on a typical web contact form. –  TomTom Mar 11 '10 at 10:43
    
thanks for clarifying this. –  mic Mar 11 '10 at 19:51

Yes, you can do it.

Change the mynetworks parameter in /etc/postfix/main.cf to include the IP address of the server you want to send from. Check that you've got append_dot_mydomain = no as well. Don't forget to tell Postfix to reload it's config (/etc/init.d/postfix reload works on most recent linuxes I've used).

Then, your postfix server should accept mail from your webserver and route it, regardless of the from/to addresses. So, configure your webapp to always use that smtp server, with the user's from address.

Increasingly, however, you can expect your emails to be marked as spam. As TomTom points out, domains are starting to adopt SPF, Domainkeys and similar protocols to prevent exactly what you're asking for. If the domain that you're sending from (domainA in your example) has implemented SPF (or similar), you would do well to ask them to add your mail server to the list of authorised senders.

HTH

share|improve this answer

It will be best if you configure your domain, mail server and web application to send from legitimate sender and put your users email addresses in Reply-To and/or somewhere in the mail body. This way you will have legitimate mail sending while keeping the right back connection to the sender. Example: You have your mail server 2.2.2.2. configured to send mail for domain MYSRV.COM. Configure your mail server with reverse and straight resolving, spf records etc. Configure your webapp to send from POSTER@MYSRV.COM, and put sender email in Reply-To header. When receiver hit reply he will send the message to the right email address. No harm for anyone.

share|improve this answer
    
that is very helpful and what I had in mind. There are two issues I could see with this: 1) the users not liking the fact that email is sent from other domain... 2) what if the mail server is hosted and the MX records for the mail server point to the hosted server, e.g. google or ISP . Then that would not work, right? –  mic Mar 11 '10 at 19:51
    
It should work ok if you have the correct dns records even if your hosting don't have spf/domainkeys (they are still good recommendations). And about users - you are not allowed to send on behalf of their domains and the only way to do it while respecting mail standards is by smtp via their real email account on their servers which is not a sollution if you have many users from different domains. –  moo Mar 12 '10 at 11:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.