Prob using "Style" in HTML Body of Email
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Prob using "Style" in HTML Body of Email

  1. #1
    Join Date
    Jan 2012
    Posts
    35

    Prob using "Style" in HTML Body of Email

    I have the following HTML code in a VB5 program sending an Email that "does not" work:

    Code:
    .Subject = MsgSubject
            .HtmlBody = "<html><body style='background-color:FFFF99'>" _
                & HtmlBodyFirstPart _
                & "</br></br><p2 style=""font-family:arial;color:red;font-size:20px;"">HAPPY BIRTHDAY!</p2>" _

    I have the following code that "does" work:
    Code:
    .Subject = MsgSubject
            .HtmlBody = "<html><body style='background-color:FFFF99'>" _
                & HtmlBodyFirstPart _
                & "</br></br><p2><font size='7' color='red' face='arial'>HAPPY BIRTHDAY!</font></p2>" _
    What is wrong with the code using "Style"????

    Thanks for your help
    Last edited by PeejAvery; February 13th, 2012 at 04:46 PM. Reason: Added code tags

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,886

    Re: Prob using "Style" in HTML Body of Email

    Probably because you're styling a non-existent tag. There's no such thing as <p2>.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,099

    Re: Prob using "Style" in HTML Body of Email

    Quote Originally Posted by DexterRose View Post
    I have the following HTML code in a VB5 program sending an Email that "does not" work:

    Code:
    .Subject = MsgSubject
            .HtmlBody = "<html><body style='background-color:FFFF99'>" _
                & HtmlBodyFirstPart _
                & "</br></br><p2 style=""font-family:arial;color:red;font-size:20px;"">HAPPY BIRTHDAY!</p2>" _
    I would suggest you use Three ( 3 ) of these : ", like this :

    Code:
    .Subject = MsgSubject
            .HtmlBody = "<html><body style='background-color:FFFF99'>" _
                & HtmlBodyFirstPart _
                & "</br></br><p2 style="""font-family:arial;color:red;font-size:20px;""">HAPPY BIRTHDAY!</p2>"
    That hsould work. The problem is when you do this :

    Code:
    ""
    It closes the existing string and starts a new one!

    Yeah, what is P2 by the way?? Does that even work??

  4. #4
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,886

    Re: Prob using "Style" in HTML Body of Email

    Ah, good catch Hannes! I missed that.

    Or you can use single quotes just like you are in the example you provided that does work.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Jan 2012
    Posts
    35

    Re: Prob using "Style" in HTML Body of Email

    You guessed it! I'm new to HTML. Thanks for the tip!

    It's amazing what happens when you use the correct format.

    Thanks

  6. #6
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,099

    Re: Prob using "Style" in HTML Body of Email

    Always glad to help

    Please remember to mark your thread resolved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center