+ boost::filesystem::path path = directory;
+ name_values['c'] = i.cinema->name;
+ path /= container_name_format.get(name_values, ".zip");
+ if (!boost::filesystem::exists (path) || confirm_overwrite (path)) {
+ if (boost::filesystem::exists (path)) {
+ /* Creating a new zip file over an existing one is an error */
+ boost::filesystem::remove (path);
+ }
+ i.make_zip_file (path, filename_format, name_values);
+ written += i.screen_kdms.size();
+ }
+ }
+
+ return written;
+}
+
+/** Email one ZIP file per cinema to the cinema.
+ * @param cinema_kdms KDMS to email.
+ * @param container_name_format Format of folder / ZIP to use.
+ * @param filename_format Format of filenames to use.
+ * @param name_values Values to substitute into \p container_name_format and \p filename_format.
+ * @param cpl_name Name of the CPL that the KDMs are for.
+ */
+void
+CinemaKDMs::email (
+ list<CinemaKDMs> cinema_kdms,
+ dcp::NameFormat container_name_format,
+ dcp::NameFormat filename_format,
+ dcp::NameFormat::Map name_values,
+ string cpl_name
+ )
+{
+ Config* config = Config::instance ();
+
+ if (config->mail_server().empty()) {
+ throw NetworkError (_("No mail server configured in preferences"));
+ }