Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send email body section text getting cut off

Status
Not open for further replies.

clientuser

Programmer
Apr 18, 2001
296
0
0
US
I have an email form setup that sends email (smtp). Whenever I send a new email, I check the variables to ensure all the data is there and then send it.

However, when the email comes in the first half of the body of text is cut off. So say for example I send this:
--------------------------------------------------------
Hi,

I need help with column 5, string 6. blah blah.

Can you also send me the updated PDF file for the help section?

thanks,

Joe
-----------------------------------------------------------

It shows in my messagebox all of the text, but in my received email it only will show:
---------------------
thanks,
Joe
---------------------

Like I said above, I am checking the strings before they are being sent out, so I think it may be a problem when they are sent or received. My code to send is here:

Code:
Sub SendEmail(ServerDomain As String, FromEmail As String, ToEmail As String, Subject As String, Body As String)


Dim strdate As String
   On Error GoTo SendEmail_Error

strdate = Format(Now, "general date")

    w.LocalPort = 0 ' Must set local port to 0 (Zero) or you can only send 1 e-mail per program start
    
    If w.State <> sckClosed Then w.Close 'close winsock if open
    
    w.Protocol = sckTCPProtocol 'use tcp/ip protocol
    w.RemoteHost = ServerDomain 'server domain
    w.RemotePort = 25           '25 is standard smtp port
    w.Connect                   'connect
    
    WaitForResponse ("220")             'wait for confirmed connection
    
    w.SendData "HELO " & ServerDomain & vbCrLf   'send HELO msg
    WaitForResponse ("250")                             'wait for response
    
    w.SendData "MAIL FROM: <" & FromEmail & ">" & vbCrLf  'sender's email
    WaitForResponse ("250")                                         'wait for response
    
    w.SendData "RCPT TO: <" & ToEmail & ">" & vbCrLf   'recipient's email
    WaitForResponse ("250")                                     'wait for response
    
    w.SendData ("data" & vbCrLf)    'tell server msg and headers are incoming
    
    WaitForResponse ("354")
    w.SendData "From: " & FromEmail & vbCrLf        'name of sender
    w.SendData "X-Mailer: Disability rate calculator" & vbCrLf 'name of program [customize it]
    w.SendData "To: " & ToEmail & vbCrLf 'name of recipient
    w.SendData "Date:  " & strdate & vbCrLf
    w.SendData "Subject: " & Subject & vbCrLf 'subject of email
    w.SendData Body & vbCrLf    'send body (message)
    
    w.SendData "." & vbCrLf     'terminate incoming data/headers
    WaitForResponse ("250")     'wait for sent mail confirmation
    
    w.SendData "quit" & vbCrLf  'say bye-bye (quit)
    WaitForResponse ("221")     'wait for server to log you off - ethics folks
    
    w.Close
    
    MsgBox "Your email has been sent!" & vbCrLf & vbCrLf & "Please allow 24-48 hours for a response.  You can also track the request at: [URL unfurl="true"]www.*********.com",[/URL] vbExclamation, "SMTP Success"
    cmdSend.Enabled = False
   On Error GoTo 0
   Exit Sub

SendEmail_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure SendEmail of Form frmEmail"
    
End Sub
 
Nevermind, I have corrected this by adding an additional vbcrlf to the subject section.

see below:

Code:
w.SendData "Subject: " & Subject & vbCrLf & vbcrlf 'subject of email
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top