borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (simple 2 way chat system)Next Topic (Create Dial Up networking) New Topic New Poll Post Reply
AndreaVB Forum : Network : SMTP VB Programming
Poster Message
loopers
Level: Guest


icon SMTP VB Programming

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
| Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1616
icon 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
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
loopers
Level: Guest

icon 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
| Quote Reply
win_dir
Level: VB Guru

Registered: 04-08-2002
Posts: 390
icon 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.

____________________________
We have a Mustek 5 M/Pix GSm@rt USB Digital Camera
for just £74.03 , offer only on until 30th February!

<AllDuck.com>      

Enquiries/Sales: 0845 430 9862
Fax: 0870 950 4532

15-05-2003 at 08:17 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
loopers
Level: Guest

icon Re: SMTP VB Programming

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
| Quote Reply
andrea_deleon
Level: Guest

icon 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
| Quote Reply
win_dir
Level: VB Guru

Registered: 04-08-2002
Posts: 390
icon 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.

____________________________
We have a Mustek 5 M/Pix GSm@rt USB Digital Camera
for just £74.03 , offer only on until 30th February!

<AllDuck.com>      

Enquiries/Sales: 0845 430 9862
Fax: 0870 950 4532

10-07-2003 at 09:33 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
andrea_deleon
Level: Guest

icon Re: SMTP VB Programming

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
| Quote Reply
Israrulhaq
Level: Guest

icon Re: SMTP VB Programming

If u want SMTP of hotmail then REQUEST me through mail.  

29-11-2003 at 08:15 AM
| Quote Reply
tushar149
Level: Guest

icon 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...

Tushar
mymail address:  tushar149@yahoo.com

14-03-2004 at 05:43 AM
| Quote Reply
AndreaVB Forum : Network : SMTP VB Programming
Previous Topic (simple 2 way chat system)Next Topic (Create Dial Up networking) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder