Results 1 to 8 of 8

Thread: Problem in Email programme

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    9

    Problem in Email programme

    i found a source code on a website, it uses simple mail transfer protocol. the problem is it runs property on my computer but failed on others' computer. i really want to know why it happened and how to solve it. is there anyone could help me?
    here is the code:
    VB Code:
    1. '--------------------------------------------------
    2. Public Connectf As Boolean
    3. Public Answerf As Boolean
    4.  
    5. '------------------------------------------
    6. Private Sub Command1_Click()
    7. Help1.Show
    8. End Sub
    9.  
    10. '---------------------------------
    11.  
    12. Private Sub Form_Load()
    13. smtptest.Show
    14. Servername.SetFocus
    15. Answerf = False
    16. Info.Text = Info.Text + vbCrLf
    17. End Sub
    18. '--------------------------------------------------
    19. Private Sub Form_Unload(Cancel As Integer)
    20. End
    21. End Sub
    22. '----------------------------------------------------
    23.  
    24. Private Sub Send_Click()
    25. Answerf = False
    26. On Error GoTo Sendfail
    27. Winsock1.RemoteHost = Servername.Text
    28. Winsock1.Connect
    29. Waiting
    30. Connectf = True
    31. Info.Text = Info.Text + vbCrLf + "Send Local Domain:" + vbCrLf
    32. Info.SetFocus
    33. SendKeys "^{END}", True
    34. Winsock1.SendData "HELO " + Frsvr.Text + vbCrLf
    35. Waiting
    36. Info.Text = Info.Text + "From:" + vbCrLf
    37. Info.SetFocus
    38. SendKeys "^{END}", True
    39. Winsock1.SendData "MAIL FROM:" + Fromxx.Text + vbCrLf
    40. Waiting
    41. Info.Text = Info.Text + "To:" + vbCrLf
    42. Info.SetFocus
    43. SendKeys "^{END}", True
    44. Winsock1.SendData "RCPT TO:" + Toyy.Text + vbCrLf
    45. Waiting
    46. Info.Text = Info.Text + "Context;" + vbCrLf
    47. Info.SetFocus
    48. SendKeys "^{END}", True
    49. Winsock1.SendData "DATA" + vbCrLf
    50. Waiting
    51. Winsock1.SendData "Subject:" + Subj.Text + vbCrLf
    52. Winsock1.SendData "Reply-To:" + Fromxx.Text + vbCrLf
    53. Winsock1.SendData "To:" + Toyy.Text + vbCrLf
    54. Winsock1.SendData "Organization: Caveman's Club" + vbCrLf
    55. Winsock1.SendData "X-mailer: Smtp tester v1.0(Written By Caveman)" + vbCrLf
    56. Winsock1.SendData "Mime-Version: 1.0" + vbCrLf
    57. Winsock1.SendData "Content-Type: text/plain; charset=""us-ascii""" + vbCrLf
    58. Winsock1.SendData "Content-Transfer-Encoding: 7bit" + vbCrLf
    59. Winsock1.SendData vbCrLf + Body.Text + vbCrLf
    60. Winsock1.SendData vbCrLf + "." + vbCrLf
    61. Waiting
    62. Info.Text = Info.Text + "Exit Connection" + vbCrLf
    63. Info.SetFocus
    64. SendKeys "^{END}", True
    65. Winsock1.SendData "QUIT" + vbCrLf
    66. Waiting
    67. Info.Text = Info.Text + vbCrLf + "Complete"+ vbCrLf
    68. Info.Text = Info.Text + vbCrLf
    69. Info.SetFocus
    70. SendKeys "^{END}", True
    71. Winsock1.Close
    72. Exit Sub
    73. Sendfail:
    74. Info.Text = Info.Text + vbCrLf + "Send Failed" + vbCrLf
    75. Info.SetFocus
    76. SendKeys "^{END}", True
    77. Winsock1.Close
    78. Send.SetFocus
    79. Connectf = False
    80. Answerf = False
    81. End Sub
    82. '--------------------------------------------------------
    83.  
    84. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    85. Dim Comedata As String
    86. Winsock1.GetData Comedata
    87. If Len(Info.Text) < 30000 Then
    88. If Len(Info.Text + Comedata) < 60000 Then
    89. Info.Text = Info.Text + Comedata
    90. Else
    91. Info.Text = Comedata
    92. End If
    93. Else
    94. Info.Text = Comedata
    95. End If
    96. Info.SetFocus
    97. SendKeys "^{END}", True
    98. Answerf = True
    99. End Sub
    100. '--------------------------------------------------------
    101. Public Sub Waiting()
    102. Dim PauseTime, Start
    103.     PauseTime = 60
    104.     Start = Timer  
    105.     Do While Timer < Start + PauseTime And Not Answerf
    106.             DoEvents    
    107.     Loop
    108.     Answerf = False
    109. End Sub

    '------------------------------------------------------------------------
    Here is the result of the Info.text on my friend's computer
    '------------------------------------------------------------------------


    1111220 21cn.com SMTP Server of AIMC 2.9.5.2 .

    Send Local Domain:
    250 21cn.com, unknown.host<127.0.0.1> okay (DELAYED).
    From:
    250 <[email protected]>, sender ok.
    To:
    250 <drpsrec>, Local recipient ok.
    Context:
    354 Start mail input; end with <CRLF>.<CRLF>
    554 From field in mail header mismatches MAIL FROM command.
    Exit connection
    221 21cn.com closing connection.

    Complete

    '--------------------------------------------------------------
    Here is the result of the Info.text on my computer
    '---------------------------------------------------------------

    220 tmailt1.svr.pol.co.uk ESMTP Exim 4.14 Sun, 04 Jan 2004 01:09:05 +0000

    Send Local Domain:
    250 tmailt1.svr.pol.co.uk Hello user-1852.l4a.c1.dsl.pol.co.uk [81.77.247.60]
    From:
    250 OK
    To:
    250 Accepted
    Context:
    354 Enter message, ending with "." on a line by itself
    250 OK id=1AcwlO-0005Lx-DP
    Exit connection
    221 tmailt1.svr.pol.co.uk closing connection

    Complete
    '-------------------------------------------------------------------------

    Could any one tell me what is the problem??
    Last edited by single64; Jan 4th, 2004 at 09:56 AM.

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