Skip to content

Mail ​

Overview ​

All Mailables live in app/Mail: 10 in the root, 46 in app/Mail/DAM and 2 in app/Mail/BackOffice. Templates are Blade views under resources/views/emails/. Most DAM notification mails have a Frontend variant (portal users) and a Backend variant (admin users), picked by $emailData['is_front_user'].

Mail goes out through Laravel's smtp mailer. When a workspace has white label turned on and its own SMTP settings saved, the mail for that workspace is sent through the workspace's SMTP server with the workspace's From address. That switch is done by WorkspaceMailService, WorkspaceMailContext and the ApplyWorkspaceMailToMessage listener, described in Workspace mail configuration.

Most mails are sent from a queued job, so the request does not wait on SMTP. See Jobs.

Queued Mailables ​

Five Mailables implement ShouldQueue: FeedbackEmail, DAM\SendDealerUserInvitationEmail, DAM\SendFeedBackEmail, DAM\SendStorageAnalyticsEmail and DAM\SendUserInvitationEmail. Every caller sends them with sendNow(), which skips the mail queue and sends in the current process. This matters: a mail pushed onto the queue would be sent later by a worker with no workspace mail context, so it would go out through the default SMTP. The other Mailables are plain and are sent with send(), usually from inside a queued job.

Brand name in mails ​

Mails that greet the user under the platform name compute $brandName from WorkspaceMailContext::currentWorkspace(): the workspace name when white_label_enabled is on, otherwise "Collage" (UserWelcomeEmail falls back to config('constant.APP_NAME')). SendSsoSeatBlockedEmail uses App\Support\WorkspaceBrand::name(), which does the same check and also provides the support address and the verified custom domain URL for links. Many DAM mails also call from() with constant.MAIL_FROM_ADDRESS or constant.MAIL_NOTIFICATION_ADDRESS and a sender name; under white label the listener overrides that From.

Mailable inventory ​

Root (app/Mail) ​

ClassSubjectViewDataSent by
FeedbackEmail (queued){brand} User Feedbackemails.Common.SendFeedback$dataApi\v1\FeedbackController, sendNow() in workspace scope
SendAssetReportEmailWorkspace Asset Report - {workspace}emails.DAM.assetReportworkspace name, asset count, XLSX attached from memorydam:export-asset-report
SendExistingUserInvitationYou're added to {workspace} on {brand} as a useremails.Common.ExistingUserInvitation$emailDataApi\v1\User\UsersController
SendGeneralInvitationYou're added on {brand}emails.Common.GeneralInvitation$emailDataUsersController, Api\v1\Workspace\WorkspaceController
SendMailForChangeUserPasswordYour login password is changed for {brand}emails.Common.MailForChangeUserPassword$emailDataUsersController
SendMonthlyWorkspaceReportEmailMonthly Workspace Activity Report - {workspace} ({period})emails.monthly_workspace_reportworkspace name, report data, start and end date; attachmentsend:monthly-workspace-reports
SendPasswordVerificationLinkReset Your Passwordemails.Common.SendResetPasswordLink$data (reset link)Api\v1\Auth\AuthController, DAM\v1\Auth\AuthController
SendSsoSeatBlockedEmailAdd seats: {employee} tried to sign in to {workspace} on {brand}emails.Common.SsoSeatBlocked$emailDataServices\Sso\SsoLoginService (to the workspace owner)
SendUserRegistrationEmailYou're successfully registered on {brand}emails.Common.UserRegistrationEmail$emailDataApi\v1\Auth\AuthController
SendWeeklyPlatformReportEmailWeekly Platform Activity Report - {date range}emails.weekly_platform_reporttwo data sets, start and end date; attachmentsend:weekly-platform-report

BackOffice (app/Mail/BackOffice) ​

ClassSubjectViewDataSent by
SendNewCustomerCreateEmailYou're invited to set the password for DAM access on {APP_NAME}emails.BackOffice.createNewCustomer$emailDataWeb\Subscription\SubscriptionController
SendPayLinkShareToEmail[Action Needed] Complete payment process for DAM subscriptionemails.BackOffice.sharePayLinkInEmail$emailDataWeb\Subscription\SubscriptionController (2 places)

Account, invitation and subscription (app/Mail/DAM) ​

ClassSubjectViewDataSent by
DamAccountActivationEmailYou're invited to set the password for access on {brand}emails.DAM.accountActivationLinkEmail$emailDataAccountActivationLinkJob
SendUserInvitationEmail (queued)You're invited for DAM access on {brand}emails.DAM.Frontend.userInvitation$emailDataSendUserInvitationEmailJob; WorkspaceController with sendNow()
SendDealerUserInvitationEmail (queued)You're invited to set the password for portal access on {brand}emails.DAM.dealerUserInvitation$emailDataSendDealerUserInvitationEmailJob; Api\v1\DigitalAssets\DealerController with sendNow() (3 places)
UserWelcomeEmailWelcome To {brand}emails.Common.userWelcomeEmail$emailDataUserWelcomeEmailJob
InstanceEmailCustom Domain Requested by {workspace}emails.DAM.Backend.instanceEmail$emailDataApi\v1\DigitalAssets\DamInstanceController (to support)
subscriptionCancelEmail{name} subscription was cancelledemails.DAM.subscriptionCancelEmail$emailDataSubscriptionCancelEmailJob (to the admin address)
SendInvoiceToCustomerEmailYour invoice from {account} #{invoice number}emails.DAM.sendInvoiceToCustomer$emailData; invoice attachedWeb\Subscription\UserController, in workspace scope
SendReceiptToCustomerEmailbuilt in the class ($subject)emails.DAM.sendReceiptToCustomer$emailDataWeb\Subscription\UserController, in workspace scope
TrialEndPayment reminder after Trial period overemails.DAM.trialEnd$emailDataNo sender found
WelcomeWelcome to {brand}, {user}!emails.welcomeEmail1$emailDataNo sender found

Trial onboarding series (app/Mail/DAM) ​

Sent in order by newsLetterEmail, one step per run, keyed on SubscriptionUsers.email_send_number. Each takes the $user model and passes it to the view as data.

StepClassSubjectView
1DigitalAssetDetailsWhat are Digital Assets?emails.digitalAssetDetailsEmail2
2DAMFeatureCollage's DAM Highlight: DAM Insightsemails.damFeatureEmail3
3OrganizeDigitalAsset7 Reasons to Organize Your Digital Assetsemails.organizeDigitalAssetEmail4
4ProductFeatureEmbedFilesCollage's DAM Highlight Directly Embed Filesemails.embedFeatureEmail5
5IncreaseBrandvalueHow Does a DAM Increase Your Brand Value?emails.increaseBrandvalueEmail6
6SendUserGroupMailCollage's DAM Highlight: Create User Groupsemails.userGroupEmail7
7SendMarketingLifeMailMaking Marketing Life Easier with DAMemails.marketingLifeEmail8
8SendFolderPermissionMailCollage's DAM Highlight: Folder Permissionsemails.folderPermissionEmail9
9SendEndFreeTrialMailWe've only just begun!emails.endFreeTrialEmail10

SendEndFreeTrialMail is also sent by the scheduled trial-end-mail command, and DigitalAssetDetails by the unused SendTuesdayThursdayMailJob. These calls use Mail::to() directly, without a workspace scope.

DAM notifications (app/Mail/DAM) ​

These are sent by DamNotification::sendEmailNotification($slug, $emailData), which SendDamEmailSystemNotificationJob calls after it has applied the workspace mail config. The subject is $emailData['notification_data']['subject'], which comes from the workspace's DamNotification setting. The view is picked from is_front_user and, for some, whether the change is one item, several items or a folder.

Notification slugClassViews (emails.DAM.{Frontend,Backend}.Notification.*)
new-user-creationSendNewUserCreationEmailBackend newUserCreateNotificationEmail
add-new-version-of-assetSendAddNewAssetVersionEmailnewAssetVersionNotificationEmail
upload-new-asset-folderSendUploadNewAssetFolderEmailuploadNewFolderEmail, uploadNewAssetFolderEmail, uploadMultipleNewAssetFolderEmail
delete-or-archive-asset-folderSendDeleteOrArchiveAssetFolderEmaildeleteMultiAssetsFolderNotificationEmail, deleteMultiAssetsFromFolderNotificationEmail, deleteMultiFolderNotificationEmail, deleteMultiAssetsNotificationEmail
generate-shared-url-for-asset-folderSendGenerateSharedUrlEmailBackend generateSharedUrlAssetEmail, generateSharedUrlAssetFolderEmail, generateSharedUrlFolderEmail
new-collection-createdSendNewCollectioncreateNewCollection
add-new-asset-in-collectionSendAddNewAssetsEmailaddAssetsInCollection, addMultipleAssetInCollection
remove-asset-in-collectionSendRemoveAssetEmailremoveAssetsInCollection
generate-link-for-sharing-collectionSendGenerateLinkForSharingCollectionBackend generateLinkForSharingCollection
generate-link-for-sharing-asset-collectionSendGenerateLinkForAssetSharingCollectionBackend generateLinkForSharingAssetCollection
remove-collectionSendRemoveCollectionEmailremoveCollection

Other DAM mails (app/Mail/DAM) ​

ClassSubjectViewDataSent by
AnnouncementEmailNew Announcement Received.emails.DAM.AnnouncementEmail$emailDataAnnouncementEmailJob
SendDailyMail$emailData['subject']emails.DAM.{Frontend,Backend}.Notification.SendDailyMail$emailDataSendDailyMailJob
SendConvertAssetsEmailJobAsset conversion from {type} to {type} is successful.emails.DAM.{Backend,Frontend}.Notification.assetConvertEmail$data with a 4-day download URLConvertAssetsJob
SendAssetsDownloadEmailJobYour download request has processed successfully!emails.DAM.Backend.Notification.assetDownloadEmail$data with a 4-day zip URLCreateAssetsZipFile command
SendFeedBackEmail (queued){name} has submitted a feedback.emails.DAM.feedbackEmail$emailDataSendFeedBackEmailJob
SendStorageAnalyticsEmail (queued)$emailData['subject']emails.DAM.storageAnalyticsEmail$emailDataSendStorageAnalyticsEmailJob
SendUserOrderEmailYour Order is In-Progress!emails.DAM.Frontend.userOrder$sendMailDataDAM\v1\Digital\AssetProductOrderController
SendAdminOrderEmailReceived New Order!emails.DAM.Backend.adminOrder$sendMailDataAssetProductOrderController
SendUserOrderCancelledToAdminEmail$sendMailData['admin_subject']emails.DAM.Backend.userCancleOrder$sendMailDataAssetProductOrderController
SendUserOrderCancelledToUserEmail$sendMailData['user_subject']emails.DAM.Frontend.userCancleOrder$sendMailDataAssetProductOrderController
SendOrderCancelledAdminEmail$sendMailData['admin_subject']emails.DAM.Backend.adminCancleOrder$sendMailDataNo sender found
SendOrderCancelledUserEmail$sendMailData['user_subject']emails.DAM.Frontend.adminCancleOrder$sendMailDataNo sender found
SendOrderStatusEmail$sendMailData['subject']emails.DAM.Frontend.orderStatus$sendMailDataNo sender found
SendOrderDeliveredStatusEmailYour order is {Delivered}!emails.DAM.Frontend.orderStatus$sendMailDataNo sender found
SendUserInvoiceEmail$sendMailData['invoice_subject']emails.DAM.Frontend.invoice$sendMailData, $attachmentNo sender found

mail:preview instantiates most of the live workspace-scoped Mailables to send them to a test inbox; it is not listed above as a sender.

Outside app/Mail, Api\v1\User\ExternalUserController sends three raw Mail::send() views (emails.external-user-invite-email, emails.external-user-otp-email, emails.external-user-request-submit-email) in a workspace scope, and EmailControl\EmailManageController references lead mail classes (NewLeadEmail and others) from the legacy LM module that have no class file in this repo.

Workspace mail configuration ​

Four pieces work together:

PieceFileRole
WorkspaceMailServiceapp/Services/WorkspaceMailService.phpapplyForWorkspace(Workspace) returns false unless white_label_enabled is on and the workspace's mailSetting has mail_host and mail_from_address. Otherwise it snapshots the env SMTP values once per process, sets mail.mailers.smtp.* (host, port, username, password, encryption) and mail.from.* from the workspace, and calls Mail::purge() so the next send builds a new transport. restoreDefaults() puts the snapshot back. scoped(?int $workspaceId, Closure) sets the context, applies the config, runs the closure, and always clears the context and restores defaults in finally. A null ID just runs the closure.
WorkspaceMailContextapp/Support/WorkspaceMailContext.phpStatic holder of the current workspace ID for this process. currentWorkspace() loads the workspace with mailSetting. Mailables read it for the brand name and the listener reads it for the From address.
ApplyWorkspaceMailToMessageapp/Listeners/ApplyWorkspaceMailToMessage.phpListens to Illuminate\Mail\Events\MessageSending (registered in EventServiceProvider). Overrides the message From with the workspace address, or cancels the send.
ApplyWorkspaceMailConfigapp/Http/Middleware/ApplyWorkspaceMailConfig.phpResolves the workspace from the workspace_id route parameter, the workspace_id input, the X-Workspace-Id header (slug, then numeric ID) or the user's default_workspace, then sets the context and applies the config. It is not registered in app/Http/Kernel.php or on any route, so it does not run today. Code relies on scoped() instead.

The workspace SMTP settings live in the WorkspaceMailSetting model (Workspace::mailSetting(), a hasOne). mail:test-smtp {workspace} {email} sends one test mail through them and prints the transport error if it fails.

Sending inside a workspace scope ​

Jobs and controllers wrap the send like this (from AccountActivationLinkJob):

php
app(WorkspaceMailService::class)->scoped(
    $this->record['workspace_id'] ?? null,
    fn () => Mail::to($this->record['email'])->send(new DamAccountActivationEmail($this->record))
);

SendDamEmailSystemNotificationJob does the same by hand: it calls WorkspaceMailContext::setForWorkspaceId() and applyForWorkspace() at the start of handle(), and clears and restores in finally.

MessageSending listener ​

A white-label workspace without complete SMTP details therefore sends no mail at all from inside its scope, instead of falling back to the Collage SMTP. Mail sent outside any scope (for example Mail::to() calls in TrialEndMail, CreateAssetsZipFile, AssetProductOrderController and the BackOffice mails in Web\Subscription\SubscriptionController) is not touched by the listener.