Change font in email.

Eljefegeneo

Still trying to learn
Local time
Yesterday, 18:59
Joined
Jan 10, 2011
Messages
902
I have a form that allows the user to customize the message to be sent via email: [txtBody]

When sending the email I want to add a line saying: If you prefer not to receive emails from our organization, please reply to this email by adding the following text to the Subject field: PLEASE REMOVE ME FROM YOUR MAILING LIST.

So, I created a hidden text box, [txtRemove] set the format to rtf, font size 9, italics; typing in the above string. But when I concatenate it with the string from txtBody, it needs to be in italics. I have tried:

Code:
  [I]Dim MsgH as string[/I]
  [I]MsgH = Replace(Me.txtRemove, Me.txtRemove, "<i>" & Me.txtRemove & "</i>")[/I]


But when I try to send the email, the result is:

[FONT=&quot]<i>If you prefer not to receive emails from our organization, please reply to this email by adding the following text to the Subject field: PLEASE REMOVE ME FROM YOUR MAILING LIST.</i>

[/FONT] [FONT=&quot]If I remove any of the "" around the <i> I get the hated red error indication.[/FONT]
Is there any way of selecting certain text to have a font change when concatenating it in a string with vba?

Currently my code is:

Code:
  [I]Dim MsgH, MsgX, Bdy as string[/I]
  [I]Bdy = me.txtBody[/I]
  [I]MsgX = Chr(13) & Chr(10) & Chr(10)[/I]
  [I]MsgH = Me.txtRemove[/I]
  [I]With mItem[/I]
  [I]    .To = Eml[/I]
  [I]    .CC = EmlCc[/I]
  [I]    .Subject = Subj[/I]
  [I]    .Body = Format(Date, "Long Date") & MsgX & "Dear" & " " & FName & " " & Surname & ":" & MsgX & Bdy & MsgX & MsgX & MsgX & MsgH[/I]
  
  [I]    .Attachments.Add (Attch)[/I]
  [I]    .Display  '(Only when thoroughly tested)
[/I]
 
You have to use htmlbody (or might be bodyhtml).
 
Not only that; the receiver's e-mail system has to allow HTML processing on inbound mail. At my last job, that was not the case.
 
That is what I thought. Too bad, not everyone can get HTML mail.
 

Users who are viewing this thread

Back
Top Bottom