Important alert: (current site time 7/16/2013 4:08:04 AM EDT)
 

VB icon

SendBugReport NEW ROUTINE ADDED

Email
Submitted on: 7/6/1999
By: Sebastian Fahrenkrog  
Level: Not Given
User Rating: By 1 Users
Compatibility: VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 18984
(About the author)
 
     Do you ever want to have a easy possibility to get in contact with your users? Here it is! You just have to add the form to your projekt and config it before you compile your projekt! Your users just have to write their comment or bug report in a textbox and hit the send button. You will love this! I ADDED A NEW ROUTINE TO PREVENT TIMEOUTS!!
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: SendBugReportNEW ROUTINE ADDED
' Description:Do you ever want to have a easy possibility to get in contact with your users? Here it is! You just have to add the form to your projekt and config it before you compile your projekt! Your users just have to write their comment or bug report in a textbox and hit the send button. You will love this!
I ADDED A NEW ROUTINE TO PREVENT TIMEOUTS!!
' By: Sebastian Fahrenkrog
'
' Inputs:You must config it (before you compile it) with your personal data, like:
E-Mail Adress 
E-Mail Server
Subjekt Line
...etc.
See the code section for more info's
'
' Returns:It send an E-Mail after you hit the Send Button!
'
' Assumes:Just copy the code below and paste it in the notepad! Save it as SendBug.frm and and add it to your projekt...
'
' Side Effects:Mail me if you find any!
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=2359&lngWId=1'for details.'**************************************

'Save it as SendBug.frm and compile it!
'-------------------8< Cut here ---------------------------------------
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Form1 
BorderStyle =0 'Kein
Caption ="Send Bug Report"
ClientHeight=3195
ClientLeft =0
ClientTop=0
ClientWidth =4680
LinkTopic="Form1"
MaxButton=0'False
MinButton=0'False
ScaleHeight =3195
ScaleWidth =4680
StartUpPosition =2 'Bildschirmmitte
Begin MSWinsockLib.Winsock Winsock1 
 Left=120
 Top =120
 _ExtentX=741
 _ExtentY=741
 _Version=393216
End
Begin VB.CommandButton Exit 
 Caption ="Exit"
 Height =255
 Left=2280
 TabIndex=2
 Top =2880
 Width=2295
End
Begin VB.CommandButton Connect 
 Caption ="Send Bug Report"
 Height =255
 Left=120
 TabIndex=1
 Top =2880
 Width=2055
End
Begin VB.TextBox Bugreporttxt 
 Height =2655
 Left=120
 MultiLine=-1 'True
 TabIndex=0
 Top =120
 Width=4455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private bTrans As Boolean
Private m_iStage As Integer
Private strData As String
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'CHANGE THIS SETTING LIKE YOU NEED IT
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Private Const mailserver As String = "your-mail-server.com"
Private Const Tobox As String = "youre-mail@adress.com"
Private Const Frombox As String = "theuser@ofthisprogram.com"
Private Const Subject As String = "Heading of the E-Mail send to you!"
'***************************************************************
'Routine for connecting to the server
'***************************************************************
Private Sub Connect_Click()
If Winsock1.State <> sckClosed Then Winsock1.Close
Winsock1.LocalPort = 0
Winsock1.Protocol = sckTCPProtocol
Winsock1.Connect mailserver, "25"
bTrans = True
m_iStage = 0
strData = ""
Call WaitForResponse
End Sub
'***************************************************************
'Transmit the E-Mail
'***************************************************************
Private Sub Transmit(iStage As Integer)
Dim Helo As String, temp As String
Dim pos As Integer
Select Case m_iStage
Case 1:
Helo = Frombox
pos = Len(Helo) - InStr(Helo, "@")
Helo = Right$(Helo, pos)
Winsock1.SendData "HELO " & Helo & vbCrLf
strData = ""
Call WaitForResponse
Case 2:
Winsock1.SendData "MAIL FROM: <" & Trim(Frombox) & ">" & vbCrLf
Call WaitForResponse
Case 3:
Winsock1.SendData "RCPT TO: <" & Trim(Tobox) & ">" & vbCrLf
Call WaitForResponse
Case 4:
Winsock1.SendData "DATA" & vbCrLf
Call WaitForResponse
Case 5:
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'If you want additional Headers like Date,Message-Id,...etc. !
'simply add them below !
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
temp = temp & "From: " & Frombox & vbNewLine
temp = temp & "To: " & Tobox & vbNewLine
temp = temp & "Subject: " & Subject & vbNewLine
'Header + Message
temp = temp & vbCrLf & Bugreporttxt.Text
'Send the Message & close connection
Winsock1.SendData temp
Winsock1.SendData vbCrLf & "." & vbCrLf
m_iStage = 0
bTrans = False
Call WaitForResponse
End Select
End Sub
'***************************************************************
'Routine for Winsock Errors
'***************************************************************
Private Sub Winsock1_Error(ByVal number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox "Error:" & Description, vbOKOnly, "Winsock Error!" ' Show error message
If Winsock1.State <> sckClosed Then
Winsock1.Close
End If
End Sub
'***************************************************************
'Routine for arraving Data
'***************************************************************
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim messagesent As String
On Error Resume Next
Winsock1.GetData strData, vbString
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'!If you have problems with sending the E-Mail, you should !
'!activate the line below and add a Textbox txtStatus, to !
'!see the Server's response!
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'txtStatus.Text = txtStatus.Text & strData
If bTrans Then
m_iStage = m_iStage + 1
Transmit m_iStage
Else
If Winsock1.State <> sckClosed Then Winsock1.Close
messagesent = MsgBox("Bug report sent! Hit exit to end program.", vbOKOnly, "Bug Report")
End If
End Sub
'**************************************************************
'NEW! Waits until time out, while waiting for response
'**************************************************************
Sub WaitForResponse()
Dim Start As Long
Dim Tmr As Long
Start = Timer
While Len(strData) = 0
Tmr = Timer - Start
DoEvents ' Let System keep checking for incoming response
'Wait 50 seconds for response
If Tmr > 50 Then
MsgBox "SMTP service error, timed out while waiting for response", 64, "Error!"
strData = ""
End
End If
Wend
End Sub
Private Sub Exit_Click()
On Error Resume Next
If Winsock1.State <> sckClosed Then Winsock1.Close
End
End Sub


Other 10 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

7/6/1999 5:39:00 PMSheepy

No matter what I do - the connection always times out.
(If this comment was disrespectful, please report it.)

 
7/6/1999 9:40:00 PMNick

Very nice code. made a little addition to it to the send button so they know that something was done.
Dim messagesent As String
messagesent = MsgBox("Bug report sent!, Hit exit to end program.", vbOKOnly, "Bug Report")
(If this comment was disrespectful, please report it.)

 
7/10/1999 4:55:00 PMKevino

The code works great. However, the reqirement of knowing the end users mail server limits the usefullness (for me at least). Any way to get the users mail server automatically??
(If this comment was disrespectful, please report it.)

 
7/15/1999 8:54:00 PMvicky

my vb reported my winsock.ocx was outdated.
does anybody have the latest version ?
please help.
(If this comment was disrespectful, please report it.)

 
8/13/1999 9:58:00 AMJustin Woodard

Vicky, just goto yahoo and do a search for this string. "Dll files beginning with G". It seems that the site is totally off topic, but im sure you can find the ocx there
(If this comment was disrespectful, please report it.)

 
8/19/1999 9:17:00 AMMondor

Ah, come on! This is a useless code because of it's interface. I will never really put it to any my program. Moreover, the e-mailing can be resolved more beautiful. I dont mean something bad - just I expected more :) Well, seems its time to write by own hands :)))
(If this comment was disrespectful, please report it.)

 
8/26/1999 5:28:00 PM-Q-2

There is a way to get the users Mail server, Its in the registry somewhere. I dont know where offhand, but its easy to find. just open regedit, go to find, and type in your mail server, and wherever it is, is the location.
(If this comment was disrespectful, please report it.)

 
10/19/1999 2:29:00 AMMike Williams

I am using my yahoo freemail account to send the bug report, but it requires authentication, how do I do that?

Regards
Mike Williams
(If this comment was disrespectful, please report it.)

 
5/16/2000 7:53:58 PMAustin

you can use any public SMTP/mail-server right? I use mailhost.onramp.net on one of my dialup computers... try that. If that doesn't work, I guess you must be part of the network...

Hope this helps-
-Austin [austinlb@home.com]
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.