CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Posts
    55

    Another E-Mail Question (SMTP)...

    I'm trying out this very nice little app for sending email written by WizBang, thanks WizBang. I can't figure out how to add a Subject line to it without generating an error. Any help would be appreciated. here is the section I'm working wth:
    Code:
    Private Sub Winsock1_Connect()
    Label1 = "Sending message..."
    Winsock1.SendData "EHLO " & UserName & vbCrLf
    If Not WaitFor("250") Then GoTo 100
    Winsock1.SendData "MAIL FROM: " & UserMail & vbCrLf
    If Not WaitFor("250") Then GoTo 100
    Winsock1.SendData "RCPT TO: " & MailRecipiant & vbCrLf
    If Not WaitFor("250") Then GoTo 100
    Winsock1.SendData "DATA" & vbCrLf
    If Not WaitFor("354") Then GoTo 100
    Winsock1.SendData MailBody & vbCrLf & "." & vbCrLf
    If Not WaitFor("250") Then GoTo 100
    Winsock1.SendData "QUIT" & vbCrLf
    If Not WaitFor("221") Then GoTo 100
    Label1 = "Message sent"
    GoTo 200
    100
    Label1 = SockData
    200
    Winsock1.Close
    End Sub
    Thanks
    Rel

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Another E-Mail Question (SMTP)...

    The subject is part of the data contained in the body of the message.

    Here are some common parts you should include, when applicable:
    date
    from
    x-mailer
    mime version
    to
    Subject
    content type
    content type message (defines the boundry for an attachment, and a few other things)
    the message body itself (your text)
    attachment (if any)
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  3. #3
    Join Date
    Dec 2002
    Posts
    55

    Re: Another E-Mail Question (SMTP)...

    How do I differentiate between the differente parts of the MailBody string. I mean how do I seperate the Subject from the Body if it is just one string?

    Thanks
    Rel

  4. #4
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Another E-Mail Question (SMTP)...

    Each part is seporated by a vbCrLf, and two vbCrLf codes before you insert the message text itself. Sorry I left out that bit of info. Perhaps I'll get to throw together an example one day, but you can find some on PlanetSourceCode.com.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

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

Featured