0

This issue is related to using my own SMTP server to send email by any user mail id like some other mail APIs do e.g; Amazon SES, MailChimp.

I am using Postfix as a mail server for my applications. I have setup TLS, DKIM, SPF and TXT records for my mailing domain i.e; mail.example.com. This mail domain is pointing to the Postfix server.

The problem is that if I send the email using some mail id of my domain like [email protected], it works well and the mail gets delivered to any of the mail servers like Gmail, or Yahoo etc. But if I send the mail form other domain mail id like [email protected] the mail appears with a warning signing that the sender is a spammer or sometimes the mail is not delivered and I get a delivery failure message saying that the mail server is not authorized to send the mail using [email protected] or [email protected]

I have done some research and learned about SPF, TXT, DKIM and TLS. I have added all these to the required server but the problem persists still.

Amazon SES, or some other Email APIs has managed this somehow so that we can send the mails from other mail ids and their mail appears in the Inbox like this: [email protected] via amazonses.com

Could anyone help me on this as it has become biggest challenge for us.

My main.cf is:

myhostname = mail.example.com
mydomain =example.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = all
proxy_interfaces = 10.2.11.292, 120.18.12.73, 18.75.58.218
unknown_local_recipient_reject_code = 550

relay_domains =

smtpd_recipient_restrictions =
permit_mynetworks
permit_sasl_authenticated
reject_unauth_destination

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

smtpd_banner = mail.example.com ESMTP

debug_peer_level = 2
debugger_command =
 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
 ddd $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop

# TLS parameters
smtpd_tls_CAfile                        = /etc/postfix/tls/xyz_com.crt
smtpd_tls_cert_file                     = /etc/postfix/tls/xyz_com.crt
smtpd_tls_key_file                      = /etc/postfix/tls/xyz_com.key
smtpd_use_tls                           = yes
smtpd_tls_session_cache_database        = btree:${queue_directory}/smtpd_scache
smtp_tls_CAfile                         = /etc/postfix/tls/xyz_com.crt
smtp_tls_cert_file                      = /etc/postfix/tls/xyz_com.crt
smtp_tls_key_file                       = /etc/postfix/tls/xyz_com.key
smtp_tls_session_cache_database         = btree:${queue_directory}/smtp_scache
smtp_use_tls                            = yes

smtpd_tls_received_header               = yes
smtpd_tls_ask_ccert                     = yes
smtpd_tls_loglevel                      = 1
tls_random_source                       = dev:/dev/urandom

# Added 16 April,2015
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname

# Added for DKIM
smtpd_milters           = inet:127.0.0.1:8891
non_smtpd_milters       = $smtpd_milters
milter_default_action   = accept
#milter_protocol         = 2

An early response will be highly appreciated.

4
  • possible duplicate of How to send emails and avoid them being classified as spam Jun 10, 2015 at 8:33
  • Could you please insert a full test email including headers, which has been classified as spam, e.g. received by gmail.com? I bet, that you are using a @gmail.com address as senders address and your own SMTP, which of course will use your server's IP address, which is not associated to gmail.com in any form, so it will get marked as spam. If you want to send in behalf of your own domain, use the Google SMTP: digitalocean.com/community/tutorials/…
    – SebiF
    Jun 10, 2015 at 10:46
  • Hi SebiF As I mentioned in my question, yes I am using my SMTP and sending mails taking @gmail.com mail id in From and Reply-to headers. But some of the popular Mail APIs as Amazon SES, Mailchimp also doing the same thing. You can send mail from any mail id (outside of your domain too) without marking it Spam.
    – Rupendra
    Jun 11, 2015 at 12:56
  • 1
    I cleaned up your posted configuration, removed all superfluous comments and settings (all that had default values), I hope you are fine with it, as now your settings are easier to look through. For your problem: You need to distinguish between the envelope and the message itself. Mail servers only care about the envelope for delivery, but the message is shown to the users by their MUAs. Also, the reputation of your mail server matters, and I guess you have none.
    – sebix
    Jun 12, 2015 at 18:45

0

You must log in to answer this question.

Browse other questions tagged .