diff --git a/src/backend/model/mediamessengers/EmailMediaMessenger.ts b/src/backend/model/mediamessengers/EmailMediaMessenger.ts index 7aae180b..a951750e 100644 --- a/src/backend/model/mediamessengers/EmailMediaMessenger.ts +++ b/src/backend/model/mediamessengers/EmailMediaMessenger.ts @@ -1,7 +1,13 @@ import {createTransport, Transporter} from 'nodemailer'; -import {MediaDTO} from '../../../common/entities/MediaDTO'; +import {MediaDTO, MediaDTOUtils} from '../../../common/entities/MediaDTO'; import {Config} from '../../../common/config/private/Config'; import {EmailMessagingType} from '../../../common/config/private/MessagingConfig'; +import {PhotoProcessing} from '../fileprocessing/PhotoProcessing'; +import {ThumbnailSourceType} from '../threading/PhotoWorker'; +import {ProjectPath} from '../../ProjectPath'; +import * as path from 'path'; +import {PhotoMetadata} from '../../../common/entities/PhotoDTO'; +import {Utils} from '../../../common/Utils'; export class EmailMediaMessenger { transporter: Transporter; @@ -26,6 +32,15 @@ export class EmailMediaMessenger { } + private async getThumbnail(m: MediaDTO) { + return await PhotoProcessing.generateThumbnail( + path.join(ProjectPath.ImageFolder, m.directory.path, m.directory.name, m.name), + Config.Media.Thumbnail.thumbnailSizes[0], + MediaDTOUtils.isPhoto(m) ? ThumbnailSourceType.Photo : ThumbnailSourceType.Video, + false + ); + } + public async sendMedia(mailSettings: { from: string, to: string, @@ -33,11 +48,47 @@ export class EmailMediaMessenger { text: string }, media: MediaDTO[]) { + const attachments = []; + const htmlStart = '