From the message you posted I can see MSDB is not set for Mail Host Status.
Database.IsMailHost Property -- Gets a value that specifies whether
the database is configured as a mail host.
To find whether the Database is a Mail Host or not, use the below PowerShell command. I tested it on SQL Server 2014.
Use the below code in Powershell ISE to check: (For Default Instance Only)
$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("MSDB")
Write-Host "Database is a mail host :" $db.IsMailHost
The MSDB database is the Database Mail host database. This database contains the stored procedures and messaging objects for Database Mail.
By default, Database Mail is not active.
You must explicitly enable Database Mail by using either
- The Database Mail Configuration Wizard
or
- The Database Mail XPs Option of the sp_configure system stored procedure.
The following example enables the Database Mail extended stored procedures.
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE
GO