var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: xp_smtp_sendmail Not Sending HTML File Right
I sent a HTML file as text message using xp_smtp_sendmail from my SQL server but the test email that I received doesn't look like the HTML file I have originally. Below are my codes:-
exec @rc = master.dbo.xp_smtp_sendmail
@FROM = Nemail@example.com',
@FROM_NAME = N'Mr XXX',
@TO = Nfirstname.lastname@example.org',
@CC = Nemail@example.com',
@priority = N'HIGH',
@subject = N'Weekly Sales To Thirds',
@type = N'text/html',
@messagefile = N'D:\WST\WeeklySalesToThirds.htm',
@server = N'999.99.999.99',
@attachments = N'D:\WST\4weeks\WST.xls'
select RC = @rc
The problem I have is the email doesn't display the HTML correctly. Spaces appeared and some of wording have wrapped.
I have attached partial screen shots of my original HTML file and email.
Please help if you have similar problem and solution. Thank you.
If it helps; this is the code I use to send HTML e-mails in SQL Server 2005
DECLARE @MessageSubject varchar(255)
DECLARE @MessageBody nvarchar(MAX)
DECLARE @EmailRecipient char(255)
SET @EmailRecipient = 'YourEmail@something.com'
SET @MessageSubject = 'Message subject :)'
SET @MessageBody =
N'Some text' +
N'<br />' +
N'More text' +
N'<br />' +
N'Last bit of text'
@recipients = @EmailRecipient ,
@subject = @MessageSubject ,
@body = @MessageBody ,
@body_format = 'HTML' ;
Thank you for the reply but I need to attach the HTML as a file because it is generated from another process (from excel). It is not just standard fixed text but text with a daily report where numbers change.
I have previously did the same and it works. Maybe the width of the HTML is small as compared to the latest.
I am also attaching it as a file but the business has requested it to show the summary page in the body of the email and the details as an attached file.