sp_send_dbmail issue when using variable for subject line
An option would be to enhance the FOR XML PATH('') to pull the actual node values out.  

See the following examples (with the results of both at the bottom).

(Original represents what you are basically doing now)

(Updated uses the enhanced FOR XML PATH('') to pull the actual node values out).  

set nocount on
Declare @T Table (LoanId int, FirstName varchar(100), LastName varchar(100))
insert into @T(LoanId,FirstName,LastName) values 
    (12345,'John','Smith'),(54321,'James','Smith')

declare @subject varchar(100)

--Original statement
SET @subject = cast((
            SELECT TOP 1 LoanId, FirstName, LastName
            FROM @t
            FOR XML PATH('')) AS NVARCHAR(MAX) ) ;

print @subject

--Updated statement
SET @subject = (
            SELECT TOP 1 'LoanId = ' + convert(varchar(10),Loanid) + ',' + 'FirstName = ' + FirstName + ',' + 'Lastname = ' + lastname
            FROM @t
            FOR XML PATH(''),TYPE).value('.','NVARCHAR(MAX)');

print @subject




&lt;LoanId&gt;12345&lt;/LoanId&gt;&lt;FirstName&gt;John&lt;/FirstName&gt;&lt;LastName&gt;Smith&lt;/LastName&gt;
LoanId = 12345,FirstName = John,Lastname = Smith