I found this somewhere on the Internet. But the problem is I can't send any mail at all from the program in this VB project. Something is wrong somewhere ... can anybody help? Here is the link to download the zip file to view the .vbp and .frm files is at http://www.fakemail.150m.com/VB_FakeMail.zip
The code is as below
Dim Reciever As Boolean
Dim Sender As Boolean
Dim MailStat As Boolean
Dim SendStat As Integer
Dim MailServer As String
MailServer = "10.0.0.3"
Private Sub Command1_Click()
GetReady
Winsock1.Connect MailServer, 25
SendStat = 1
End Sub
Private Sub Form_Load()
Reciever = False
Sender = False
GetReady
End Sub
Private Sub txtRecieve_GotFocus()
If Reciever = False Then
txtRecieve.Text = ""
Reciever = True
End If
End Sub
Private Sub txtSender_GotFocus()
If Sender = False Then
txtSender.Text = ""
Sender = True
End If
End Sub
Function GetReady()
Do While Winsock1.State <> sckClosed
DoEvents
Winsock1.Close
Loop
End Function
Private Sub Winsock1_Connect()
txtStatus.Text = "Connected.." & vbNewLine
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
Winsock1.GetData Data
txtStatus.SelLength = Len(txtStatus.Text)
txtStatus.SelText = Data
Select Case SendStat
Case 1
Winsock1.SendData "HELO TEST" & vbCrLf
Case 2
Winsock1.SendData "MAIL FROM:" & txtSender.Text & vbCrLf
Case 3
Winsock1.SendData "RCPT TO:" & txtRecieve.Text & vbCrLf
Case 4
Winsock1.SendData "DATA" & vbCrLf
Winsock1.SendData "subject:" & txtSubject.Text & vbCrLf
Winsock1.SendData txtMessage.Text & vbCrLf
Case 5
Winsock1.SendData vbCrLf & "." & vbCrLf
Case 6
Winsock1.SendData "QUIT" & vbCrLf
End Select
SendStat = SendStat + 1
End Sub
Anybody can help me debug this problem? Thanks.
[loopers - it's VBCode, not code (case sensitive), I changed it for appearance - JLRodgers]
[Edited by JLRodgers on 14-05-2003 at 01:03 PM GMT]
14-05-2003 at 02:35 PM
|
JLRodgers Level: Moderator Registered: 04-04-2002 Posts: 1616
Re: SMTP VB Programming
Unless the 10.0.0.3 is a valid mail server, it won't work regardless of the code.
____________________________ Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)
14-05-2003 at 07:05 PM
|
loopers Level: Guest
Re: SMTP VB Programming
Even after I have enter a valid mail server from a list of SMTP mail server here http://www.openrelaycheck.com/orc/openrelaylist.asp ... I still get the same error msg from VB 6.0 (Enterprise Edition), which is
"Compile Error: Invalid Outside Procedure"
Any help is truly appreciated.
15-05-2003 at 04:00 AM
|
win_dir Level: VB Guru Registered: 04-08-2002 Posts: 390
Re: SMTP VB Programming
Although i have a lot of experience programming many things i have never put a value into a variable in the declarations space. I usually put a value in the variables in the Form_Load() sub. Just try putting the
MailServer = "10.0.0.3"
into the Form_load() sub. I don't currently have VB with me to test it. Anyway, just a random suggestion. Reply if it works.
I didn't see any error msg now. But this program still unable to send any email message at all.
15-05-2003 at 01:18 PM
|
andrea_deleon Level: Guest
Re: SMTP VB Programming
Hi loopers.
I like to learn this too. Will you give me a favor?
Please email me the file VB_FakeMail.zip so that I can study it too.
I tried to download it from the URL you posted but I was unable to.
Thanks.
andrea_deleon@eudoramail.com
10-07-2003 at 08:19 PM
|
win_dir Level: VB Guru Registered: 04-08-2002 Posts: 390
Re: SMTP VB Programming
hey loopers, i didn't get your last message which you probably posted quite a while ago. If you are still working on it then just mail me at webmaster@isgeeky.com and you can try sending the emails through my server and i'll give you a log of the commands that it is sending although it will not be able to actually send the email due to the restrictions i put on it to prevent spamming.
Are you still there loopers?
Can you email me your VB_FakeMail.zip please? I'd like to learn how this thing works. Thanks.
14-07-2003 at 05:33 PM
|
Israrulhaq Level: Guest
Re: SMTP VB Programming
If u want SMTP of hotmail then REQUEST me through mail.
29-11-2003 at 08:15 AM
|
tushar149 Level: Guest
Re: SMTP VB Programming
Hello
It has worked on my machine. You have to declare mailserver variable in formload. And instead of giving IP address of the server just mention name of the server. And i have done it successfully. Just say in form(from where you want to send mail & to(to whom you want to send) and in txtstatus bar you will say all action going on... and when i have checked my mail i ahd received those mails that i had sent using this system...