Can't share via email

I am running on 15.0.5 (upgraded to 15.0.2). As far as I can tell, both versions had this exact same problem. I have mail configured and test is working as expected. However, if I attempt to share a file/folder to someone external with email, it is failing with the following error logged.

{"reqId":"CMlzSR99R6h7Af04DF7F","level":3,"time":"2019-03-04T06:45:12+00:00","remoteAddr":"10.1.20.10","user":"E991A7B5-73DC-4DE5-9148-6DB5C220C52B","app":"sharebymail","method":"POST","url":"/ocs/v2.php/apps/files_sharing/api/v1/shares?format=json","message":{"Exception":"Swift_TransportException","Message":"Expected response code 354 but got code \"503\", with message \"503 5.5.2 Need rcpt command\r\n\"","Code":503,"Trace":[{"file":"/var/www/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php","line":341,"function":"assertResponseCode","class":"Swift_Transport_AbstractSmtpTransport","type":"->","args":["503 5.5.2 Need rcpt command\r\n",[354]]},{"file":"/var/www/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php","line":305,"function":"executeCommand","class":"Swift_Transport_AbstractSmtpTransport","type":"->","args":["DATA\r\n",[354],["someone@gmail.com"],false,null]},{"file":"/var/www/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php","line":390,"function":"executeCommand","class":"Swift_Transport_EsmtpTransport","type":"->","args":["DATA\r\n",[354],["someone@gmail.com"]]},{"file":"/var/www/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php","line":497,"function":"doDataCommand","class":"Swift_Transport_AbstractSmtpTransport","type":"->","args":[["someone@gmail.com"]]},{"file":"/var/www/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php","line":516,"function":"doMailTransaction","class":"Swift_Transport_AbstractSmtpTransport","type":"->","args":[{"__class__":"Swift_Message"},"admin@dotslash.io",["someone@gmail.com"],["someone@gmail.com"]]},{"file":"/var/www/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php","line":206,"function":"sendTo","class":"Swift_Transport_AbstractSmtpTransport","type":"->","args":[{"__class__":"Swift_Message"},"admin@dotslash.io",{"someone@gmail.com":null},["someone@gmail.com"]]},{"file":"/var/www/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php","line":71,"function":"send","class":"Swift_Transport_AbstractSmtpTransport","type":"->","args":[{"__class__":"Swift_Message"},["someone@gmail.com"]]},{"file":"/var/www/nextcloud/lib/private/Mail/Mailer.php","line":180,"function":"send","class":"Swift_Mailer","type":"->","args":[{"__class__":"Swift_Message"},["someone@gmail.com"]]},{"file":"/var/www/nextcloud/apps/sharebymail/lib/ShareByMailProvider.php","line":442,"function":"send","class":"OC\\Mail\\Mailer","type":"->","args":[{"__class__":"OC\\Mail\\Message"}]},{"file":"/var/www/nextcloud/apps/sharebymail/lib/ShareByMailProvider.php","line":354,"function":"sendMailNotification","class":"OCA\\ShareByMail\\ShareByMailProvider","type":"->","args":["2018-11-06","https://nextcloud.dotslash.io/s/9TF9Tw5iaspZdMq","E991A7B5-73DC-4DE5-9148-6DB5C220C52B","someone@gmail.com",null]},{"file":"/var/www/nextcloud/apps/sharebymail/lib/ShareByMailProvider.php","line":182,"function":"createMailShare","class":"OCA\\ShareByMail\\ShareByMailProvider","type":"->","args":[{"__class__":"OC\\Share20\\Share"}]},{"file":"/var/www/nextcloud/lib/private/Share20/Manager.php","line":670,"function":"create","class":"OCA\\ShareByMail\\ShareByMailProvider","type":"->","args":[{"__class__":"OC\\Share20\\Share"}]},{"file":"/var/www/nextcloud/apps/files_sharing/lib/Controller/ShareAPIController.php","line":567,"function":"createShare","class":"OC\\Share20\\Manager","type":"->","args":[{"__class__":"OC\\Share20\\Share"}]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":166,"function":"createShare","class":"OCA\\Files_Sharing\\Controller\\ShareAPIController","type":"->","args":[{"__class__":"OC\\Files\\Node\\Folder"},31,4,"someone@gmail.com","false","",null,"",""]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_Sharing\\Controller\\ShareAPIController"},"createShare"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_Sharing\\Controller\\ShareAPIController"},"createShare"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files_Sharing\\Controller\\ShareAPIController","createShare",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ocs.files_sharing.ShareAPI.createShare"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"_route":"ocs.files_sharing.ShareAPI.createShare"}]},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"_route":"ocs.files_sharing.ShareAPI.createShare"}]},{"file":"/var/www/nextcloud/ocs/v1.php","line":82,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/files_sharing/api/v1/shares"]},{"file":"/var/www/nextcloud/ocs/v2.php","line":24,"args":["/var/www/nextcloud/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/nextcloud/3rdparty/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php","Line":457,"CustomMessage":"Failed to send share by mail."},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36","version":"15.0.5.3","id":"5c7cc9d723340"}

Looks like it’s an Exchange issue. Please disregard.

I appear to be having a similar problem with Exchange. What did you do to fix it?

You need configure your Exchange to allow relay email for internal servers. Since most likely they are trying to relay via postfix or something similar, and attempting to do so without authentication, Exchange’s default behavior is to reject such requests and Nextcloud then comes back with the above error.

1 Like