Results 1 to 11 of 11

Thread: [RESOLVED] How do I create a paragraph in an e-mail?

  1. #1

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Resolved [RESOLVED] How do I create a paragraph in an e-mail?

    Hello everybody.

    I have created a program that sends an e-mail but the body of my e-mail always creates one line of messages. For example, if I want to write Dear Tommy on the first paragraph and Dear Jhonny on the next. I can't seem to create paragraphs.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How do I create a paragraph in an e-mail?

    You can add a carriage return and a line feed inbetween your text.
    VB Code:
    1. MessageBox.Show("Dear Tommy" & ControlChars.CrLf & "Dear Jhonny")
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do I create a paragraph in an e-mail?

    Runtime alert! ControlChars.CrLf? Environment.NewLine.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How do I create a paragraph in an e-mail?

    ControlChars is part of MS VB Namespace. You have said and provn that its the same thing but just not viewed as .NET code.

    Anyways, lets not get into another looooog thread about MSVB Namespace.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: How do I create a paragraph in an e-mail?

    Hmmm.... It didn't worked. There is defininitely something wrong with my code. Here have a look see.

    VB Code:
    1. 'Week 2
    2. Imports System.Web.Mail
    3.  
    4. Public Class WebForm1
    5.     Inherits System.Web.UI.Page
    6.  
    7. #Region " Web Form Designer Generated Code "
    8.  
    9.     'This call is required by the Web Form Designer.
    10.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    11.  
    12.     End Sub
    13.     Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    14.     Protected WithEvents Label2 As System.Web.UI.WebControls.Label
    15.     Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    16.     Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
    17.  
    18.     'NOTE: The following placeholder declaration is required by the Web Form Designer.
    19.     'Do not delete or move it.
    20.     Private designerPlaceholderDeclaration As System.Object
    21.  
    22.     Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    23.         'CODEGEN: This method call is required by the Web Form Designer
    24.         'Do not modify it using the code editor.
    25.         InitializeComponent()
    26.     End Sub
    27.  
    28. #End Region
    29.  
    30.     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    31.         'Put user code to initialize the page here
    32.         Label1.Text = "Thomas"
    33.         Label2.Text = "[email protected]"
    34.         Button1.Text = "Submit"
    35.     End Sub
    36.  
    37.     Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    38.         Dim AutoEmail As New MailMessage
    39.         AutoEmail.To = Label2.Text
    40.         AutoEmail.From = "[email protected]"
    41.         AutoEmail.Subject = "Test subject from VB.NET"
    42.         AutoEmail.BodyFormat = MailFormat.Html
    43.         AutoEmail.Body = "Ian" & ControlChars.CrLf & "Paul"
    44.         AutoEmail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "25")
    45.         System.Threading.Thread.Sleep(200)
    46.         SmtpMail.SmtpServer = "192.168.11.11"
    47.         System.Threading.Thread.Sleep(200)
    48.         SmtpMail.Send(AutoEmail)
    49.     End Sub
    50. End Class

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How do I create a paragraph in an e-mail?

    Did you try Johns "Environment.NewLine" or any othe variations
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: How do I create a paragraph in an e-mail?

    Hmmm.... Environment.NewLine does not work also. Can you give me more, what you call variations because I am a newbie at VB.NET.

    The problem is when I open my e-mail at Yahoo the body of the e-mail says "Ian Paul" instead of "Ian <next line> Paul".

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do I create a paragraph in an e-mail?

    You've set your mail format as HTML so perhaps you need to use HTML tags. Try using <p> or <br> tags.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Thumbs up Re: How do I create a paragraph in an e-mail?

    Quote Originally Posted by jmcilhinney
    You've set your mail format as HTML so perhaps you need to use HTML tags. Try using <p> or <br> tags.
    WOW!!!! It worked. Thanks man, you are the best.

  10. #10
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do I create a paragraph in an e-mail?

    *basking in admiring glow*

    Cool. Don't forget to resolve your thread from the Thread Tools menu.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  11. #11

    Thread Starter
    Hyperactive Member tommygrayson's Avatar
    Join Date
    Aug 2005
    Location
    In my Nissan Silvia
    Posts
    433

    Re: How do I create a paragraph in an e-mail?

    I will. Thaks again.

Posting Permissions

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



Click Here to Expand Forum to Full Width