5 Replies Latest reply: Apr 24, 2012 5:23 PM by MattMacPro
PrinceZordar Level 1 (65 points)

Set up a new 10.7.2 Server, enabled OD, added 6 users. Set up iCal Server, everything works fine between OD users. Problem is when you try to share a calendar with an e-mail address for someone outside the company, iCal comes back with "The server returned an error" and "Mail gateway didn't find a token in message" shows up in the iCal Server log.


We created a new dedicated e-mail account on their mail server (hosted by their ISP, not by the server I just installed) and put all the info into the iCal settings in the Server app. As far as I can tell that part is working. I also tried creating a Gmail account, but I get the same errors.


Google hasn't been much help. Only reference to the token error was from someone else's calendar server application, and wanted me to edit caldavd.plist (I checked the settings there just in case, and it all is correct.)


The server is hostings DNS for itself, but all other DNS info is being provided by their Airport Extreme.



  • ChristopherJohn Level 1 (0 points)

    Congrats on getting everything else up and running.

    I have the same exact issue with Calendar invitations not working. Mail is hosted on the server itself and the Invitations email address is an account on the same server.

    Invitations sent between accounts (email addresses) on the server seem to work properly. It's just external email invites.

    This appears to be relevant from the caldavd error.log (domain names changed to protect the innocent)


    2011-12-31 12:57:46-0500 [-] [mailgateway] 2011-12-31 12:57:46-0500 [Uninitialized] SMTP Client retrying server. Retry: 5

    2011-12-31 12:57:46-0500 [-] [mailgateway] 2011-12-31 12:57:46-0500 [Uninitialized] SMTP Client retrying server. Retry: 4

    2011-12-31 12:57:46-0500 [-] [mailgateway] 2011-12-31 12:57:46-0500 [Uninitialized] SMTP Client retrying server. Retry: 3

    2011-12-31 12:57:46-0500 [-] [mailgateway] 2011-12-31 12:57:46-0500 [Uninitialized] SMTP Client retrying server. Retry: 2

    2011-12-31 12:57:46-0500 [-] [mailgateway] 2011-12-31 12:57:46-0500 [Uninitialized] SMTP Client retrying server. Retry: 1

    2011-12-31 12:57:46-0500 [-] [mailgateway] 2011-12-31 12:57:46-0500 [Uninitialized] [twistedcaldav.mail.MailHandler#error] Mail gateway failed to send message <20111231175746.32769.1632120348.2@server.domain.com> from user@domain.com to mailto:user@externaldomain.com (Reason: Connection was refused by other side: 61: Connection refused.)

    2011-12-31 12:57:46-0500 [-] [caldav-1]  [AuthorizedHTTPGetter,client] [twistedcaldav.scheduling.imip#error] Could not do server-to-imip request : <twistedcaldav.scheduling.imip.ScheduleViaIMip object at 0x10c471ed0> 400 Bad Request

    2011-12-31 12:57:46-0500 [-] [caldav-1]  [AuthorizedHTTPGetter,client] [twistedcaldav.scheduling.scheduler.ScheduleResponseQueue#error] Error during PUT for mailto:user@externaldomain.com: iMIP request failed


    I guess the key error, in my case, is "Mail gateway failed to send message." Doesn't really make any sense because the mail server can send regular emails to the same external domains without any trouble.



  • spekkie Level 1 (20 points)

    Well i had it working similar setup except i did not enter any email adress at first only tagged the option to invite external emailadress. It did send under a strange email adress like com.apple.calendarserver+974fae7b-a...............@ although it worked. Once i changed it to a real emailadress all stopped working ever since. There seems to something broken here.

  • davidh Level 4 (1,890 points)

    Could be a couple different things going on.


    Bear in mind that Greylisting is on by default as of 10.6 Server and that *will* interfere with legitimate, desired mail transactions. Also in terms of the email address used &/or replied from - see my write up for 10.6 on this at


  • PrinceZordar Level 1 (65 points)

    Today I reloaded the server in question. Downloaded 10.7.3 via the Recovery Partition, restored the OD archive, and tried to set up iCal. I have exactly the same problem.


    I set up a calendar on a Lion client, and try to set it to share with someone who has an OD account. The sharing dialog closes, but no invite is ever sent. If I try to share with someone who is not in OD, I get error messages in the server log.


    An entire afternoon of Googling shows a lot of people are having the same problem. Best I can tell, it seems to happen if your e-mail server is hosted elsewhere, as if iCal Server assumes that the mail server is on the same Mac. This is not the case with this setup. Their web page and domain are hosted outside as well, but we have a DNS entry made so server.domain.com forwards to the Mac Mini server inside their office. We've tested this for VPN, Remote Desktop, and FileMaker access, and all work fine.


    I've tried two types of configurations, neither of which is working.


    1. Created an ical@domain.com account with their mail host. I used that outside mail server information for IMAP / SMTP settings, but every time I try to share a calendar the iCal error log shows IMAP login errors. Their mail server does not use SMTP authentication. They have the option to use SSL or not, but neither work.


    2. Used com.apple.calendarserver@server.domain.com, and used the default localhost server info. I then tried to set up the server's built in Mail server to forward mail to their outside mail host. This started giving me


    [mailgateway] 2012-04-05 19:51:05-0400 [IMAP4DownloadProtocol,client] Unhandled unsolicited response: ['OK', ['HIGHESTMODSEQ', '1'], 'Highest']


    I now get that error no matter what I do, meaning something broke again.


    I've gone through several Google pages referring to greylisting, the postfix, etc, but since the server is not running a Mail server, none of these apply.


    I have no idea what I am doing wrong. Lion has been out a year, surely in that time this has been worked out. So why can't I find a solution? Everywhere I look it's either a thread starting out with the same problem I am having, followed by a dozen or so "me too" posts, or it's someone saying they managed to make it work, but their fix doesn't work for me. I'm really frustrated right now, and so is my customer.


    Oh, almost forgot... now we have a new problem. FileMaker Admin requires access to port 16000, but for whatever reason the server is blocking that port. It's not running a firewall. Good to know that reloading causes more problems than it solves.

  • MattMacPro Level 1 (0 points)



    I posted a few answers on another post that might help you -


    iCal Server External Invitees not working