I tried making a shepherd service for a different mail service also. This other one also runs fine manually but fails with some networking related error when run as a shepherd service. Apparently there is something more that needs to be done in order for a shepherd service to succesfully use networking.
I can't find this documented anywhere in the manual, so I've checked the source code to find other shepherd services to look at, but so far I can't find any answers there either. I must be missing something obvious here, since other shepherd services are able to use networking just fine.