Results 1 to 5 of 5

Thread: [SOLVED] Send mails from external account trough Zimbra

  1. #1
    fleiben is offline Starter Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    4

    Default [SOLVED] Send mails from external account trough Zimbra

    Hi all,

    I'm fairly new to Zimbra but managed to install the ZCS community edition 7.0.0_GA_3077 on Ubuntu 10.04 Server. Sending and receiving mails works just fine.

    My Problem:
    It is quite easy to get Zimbra to fetch mails from external mail accounts (via POP3 or IMAP) but in addition to that I would like to send mails "from" these external accounts.

    My Zimbra account: me@mydomain.com
    Some external account: me@somedomain.com

    I set up postfix as described in this post [SOLVED] multiple accounts on smtp relay
    By doing this postfix can send outgoing mails to different relay servers depending on the mail address they originate from. I verified this using telnet (localhost port 25) on the Zimbra server. Works great, meaning if I send a mail from me@somedomain.com postfix automatically relays it to smtp.somedomain.com instead of sending it to the default relay server of my domain hoster.

    But if I send a mail using the Zimbra Web-Client and choose an external account as the origin of my mail (e.g. me@somedomain.com) Zimbra substitutes the "from" address of my mail for the address of my Zimbra account (me@mydomain.com). This causes postfix NOT to send the mail to the "right" relay host. BTW I already checked "Allow sending email from any address" in the preferences.

    Is it somehow possible to prevent Zimbra from substituting the "from" so that postfix could route the mail to the right relay host? I'm very grateful for any pointers!

    Tanks in advance!
    Benjamin

    EDIT:
    Found solution here Bug 40731 – Wrong MAIL FROM in SMTP dialog when using a Persona

    SMTP behavior now switches based on the value of
    zimbraSmtpRestrictEnvelopeFrom. When it's set to TRUE, we force
    MAIL FROM in the SMTP session to be the address of the account.
    When it's set to FALSE, MAIL FROM is set to either the Sender or
    From header value in the outgoing message, in that order.
    zmprov mc default zimbraSmtpRestrictEnvelopeFrom FALSE
    Last edited by fleiben; 02-26-2011 at 06:04 AM. Reason: Found solution

  2. #2
    sparticle is offline Intermediate Member
    Join Date
    Aug 2006
    Posts
    21
    Rep Power
    9

    Default

    You say:

    My Problem:
    It is quite easy to get Zimbra to fetch mails from external mail accounts (via POP3 or IMAP) but in addition to that I would like to send mails "from" these external accounts.


    Can you explain how you have set this up. I need to do this for all mail to my users that is sent to external mail domain. Then fetch this mail and disctibute to the local mail users on my non routable local zimbra mail domain. I have been stuck onthis point for a number of years, so have not been able to migrate to zimbra without this capability.

    Cheers
    Stephen

  3. #3
    fleiben is offline Starter Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    4

    Default

    Hi Stephen,

    I have only a few accounts on my zimbra server. My approach might not be optimal for a setup with many accounts.

    Fetching external mails:
    After you have created your zimbra accounts you can manually add external pop3 or imap accounts for each of those zimbra accounts. I guess this can be done in terminal if you have to setup many accounts. I logged into each zimbra account (zimbra web client) went to "Preferences" > "Accounts" to create external accounts. But I guess you already figured this out yourself.

    Because zimbra did only poll external mails when I pressed the "Fetch external Mails"-button in the web client I had to run the following command in terminal as user zimbra:
    Code:
    zmprov mc default zimbraDataSourcePollingInterval 5m
    This would result in zimbra polling your external accounts every five minutes.

    As an alternative there are some posts suggesting to use fetchmail to accomplish the same.

    Sending "external" mails:
    STEP 1
    This is a bit more tricky. First of all you need to add the external mail addresses to the corresponding zimbra accounts. This can be done in the admin console. Edit each account and go to the "Preferences" tab. There should be a text field labeled "only allow sending mail from the following addresses" (or something like that). Add all external addresses of your zimbra account and save your changes. It is important that you do not check the checkbox "allow sending mails from all addresses" above the text field. This could lead to major security problems in this setup.

    STEP 2
    Next you need to edit the MTA settings of your server. In the Admin Console go to "Managing Servers" and then the MTA tab. There should be a text field "Relay MTA for external delivery". There you need to enter the "default" smtp server (and port) you want to send your mails through. The downside of this is that from now on everyone on your server is able to send mails through this smtp server. Since most smtp servers replace the "from" address with the one you use to authenticate yourself against the smtp server everyone on your zimbra server could possibly send mails from this account. I'm not sure if there is a way around it at least I did not find a easy one. One possible solution could be to use a nonexistent MTA Relay server. Since every zimbra user will send his mails using his or her own smtp settings (server, username and password) this might work. BTW it won't work to leave the field empty because zimbra would then attempt to deliver the mails itself (not using any relay smtp server).

    On the same tab uncheck the checkbox "Enable DNS lookups".

    Save your changes.

    Run the following command from terminal as user zimbra
    Code:
    zmprov mc default zimbraSmtpRestrictEnvelopeFrom FALSE
    This command is very important because otherwise zimbra would replace the "from" address of outgoing mails with the zimbra account name (and local domain) the mail is sent from. Setting zimbraSmtpRestrictEnvelopeFrom to FALSE allows a zimbra user to send mails from each address you specified (for this user) in STEP 1.

    STEP 3
    The next and last step would be to modify postfix. This depends in large parts on your requirements and your smtp relay provider.

    Have a look at the following forum post by mirkoguidolin
    multiple accounts on smtp relay

    Create the file /opt/zimbra/conf/relayhost_map and enter all external mail addresses for all your zimbra accounts in the form
    Code:
    external-user1@external-domain1.com [smtp.external-domain1.com]:port1
    external-user2@external-domain2.com [smtp.external-domain2.com]:port2
    external-user3@external-domain3.com [smtp.external-domain3.com]:port3
    ...
    (port is optional)

    Create the file /opt/zimbra/conf/relay_password and enter the smtp login information for each external account of all your users in the following form
    Code:
    external-user1@external-domain1.com smtp-username1:smtp-password1
    external-user2@external-domain2.com smtp-username2:smtp-password2
    external-user3@external-domain3.com smtp-username3:smtp-password3
    ...
    Then need to enter the login information for your default relay MTA you specified in STEP 2 in the following form
    Code:
    default-smtp-server:port default-smtp-username:default-smtp-password
    The forum post I referred to above suggests using the form
    Code:
    [default-smtp-server]:port default-smtp-username:default-smtp-password
    but this did not work for me.

    You need to run the following commands to enable sender dependent authentication (again as user zimbra)
    Code:
    postconf -e smtp_sender_dependent_authentication=yes
    postconf -e sender_dependent_relayhost_maps=hash:/opt/zimbra/conf/relayhost_map
    postconf -e smtp_sasl_auth_enable=yes
    postconf -e smtp_sasl_password_maps=hash:/opt/zimbra/conf/relay_password
    
    postmap /opt/zimbra/conf/relayhost_map
    postmap /opt/zimbra/conf/relay_password
    Each time you edit one of the files relayhost_map or relay_password you need to re-hash the file by running the appropriate portmap command from above.

    Depending on the authentication mechanism your provider uses you should have a look at the following wiki page
    Enabling SMTP authentication

    In my case I had to run the following commands
    Code:
    postconf -e smtp_cname_overrides_servername=no
    postconf -e smtp_use_tls=yes
    After you are done editing the postfix system it needs to be reloaded
    Code:
    postfix reload
    STEP 4
    Now you should be able to send mail from external mail addresses using the zimbra web client. Create a new mail and select an external account before you hit Send. If you want to send mails from a external mail address you did not add as an external account in the step "Fetching external mails" you can add a personality for this mail address to accomplish the same (web client > "Preferences" > "Accounts" > "Add Personality").

    To debug the whole sending process I found the log file /var/log/zimbra.log quite useful. Here you can see which smtp relay server your outgoing mails are actually sent to and which "from" address is used.

    I hope I could answer your questions or at least offer some pointers how this could be done.

    Regards,
    Benjamin

  4. #4
    sparticle is offline Intermediate Member
    Join Date
    Aug 2006
    Posts
    21
    Rep Power
    9

    Default

    Thanks for thi. I will need to work through this. Todau I have installed zcs 7 twice from scratch.

    Cheers
    Stephen

  5. #5
    hrishi18 is offline Starter Member
    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    2

    Default

    Quote Originally Posted by sparticle View Post
    Thanks for thi. I will need to work through this. Todau I have installed zcs 7 twice from scratch.

    Cheers
    Stephen
    Hi All,

    I'm new to Zimbra and mailing systems.I have installed zimbra mail server [RHEL machine] (mailsrv.example.com) and have a DNS server [RHEL machine] (prod.example.com) in which I have properly configured the MX records.I have also have installed nagios on the DNS server which properly monitors other Linux and Windows machines on the network.I have configured nagios to send alerts to the users as created in zimbra. If i try to send test mail from users created within zimbra to each other, it works fine. Default sendmail is installed in the DNS server. I am not able to send mail from the shell prompt of the DNS to any users created in zimbra.Hence nagios alerts are also not delivered. I tried to use relay host, but I I need some help here, so that the mails can be delivered accordingly. If there is any other alternative please assist.


    Regards,
    Hrishi

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Similar Threads

  1. Old Backup stay in TO_DELETE status and no clearing..
    By bartounet in forum Administrators
    Replies: 0
    Last Post: 10-05-2010, 07:40 AM
  2. Replies: 12
    Last Post: 02-25-2008, 07:28 PM
  3. Zimbra shutdowns every n hours.
    By Andrewb in forum Administrators
    Replies: 13
    Last Post: 08-14-2007, 08:55 AM
  4. Replies: 8
    Last Post: 02-27-2007, 04:10 AM
  5. huge log size
    By rmvg in forum Administrators
    Replies: 5
    Last Post: 01-02-2007, 10:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •