• Welcome to Valhalla Legends Archive.
 

Sending an email..

Started by QwertyMonster, July 08, 2005, 01:33 PM

Previous topic - Next topic

QwertyMonster

   
  ' need SMTP server to route message thru, 25 (SMTP)
  Winsock1.Connect "smtp.freeserve.net", 25
   


The email server isn't working. Any ideas on what i can put for connecting to a server to send an email, in visual basic?

R.a.B.B.i.T

It may not run on port 25.  If it's using TLS or some other form of secure stream, you'll need to connect to the proper port.

QwertyMonster

It is 25, i have been reading tutorials on it. Its sent via SMTP. Any ideas people? Or could somebody point me in another direction for what to connect to, to send an email? Thanks in advance!

UserLoser.

That address works fine... just tested and it sent me:

220 cmailm1.svr.pol.co.uk ESMTP Exim 4.41 Fri, 08 Jul 2005 21:57:25 +0100

QwertyMonster

#4
some more problems, connects and everything but i dont receive email.

heres my code


  sFrom$ = Me.frmemail.Text
  sTo$ = "<my email here>"
  sSubject$ = "testy"
  sMessage$ ="this is a test"
   
  ' need SMTP server to route message thru, 25 (SMTP)
  Winsock1.Connect "smtp.freeserve.net", 25
   
  Do While Winsock1.State <> sckConnected: DoEvents: Loop
   
   
  sendMsg "HELO " & "Peaches"
  sendMsg "MAIL FROM: <" & sFrom & ">"
  sendMsg "RCPT TO: <" & sTo & ">"
  sendMsg "DATA"
   

  m$ = m$ + "From: <" + sFrom + ">" + vbCrLf
  m$ = m$ + "To: <" + sTo + ">" + vbCrLf
  m$ = m$ + "Subject: " + sSubject$ + vbCrLf
  m$ = m$ + "Date: " + Format$(Now, "h:mm:ss") + vbCrLf
  m$ = m$ + "MIME-Version: 1.0" + vbCrLf
  m$ = m$ + "Content-Type: text/plain; charset=us-ascii" + vbCrLf + vbCrLf
   
  m$ = m$ + sMessage$ + vbCrLf + vbCrLf + "." + vbCrLf
   
  sendMsg m$ + "QUIT"
   
  Winsock1.Close

Newby

Uh.

sendMsg m$
sendMsg "QUIT"

Try that instead of combining them.

I'd re-write all of that coding, personally.

It's sloppy as hell.
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

QwertyMonster

Well it doesn't crash anymore. But still no email. Any ideas people?

Newby

I don't know much about SMTP, but is there a message you're supposed to send when you're done with DATA?
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Mangix

erm i just read something on winsockvb.com and it says that after you attempt to send it, the SMTP(or POP3) server replies with a number indicating what happened. perhaps you could get the number with the DataArrival sub to find out why it isnt sending?

then again im not familiar with SMTP servers.

UserLoser.

Maybe that mail server requires authentication?

R.a.B.B.i.T

#10
554 SMTP synchronization error

You're not allowed to send mail.

More info: http://www.networksorcery.com/enp/protocol/smtp.htm

QwertyMonster

554: Transaction failed.

Thanks for that website Rabbit. :) It helps. I will post when i get more problems :)

MyndFyre

If you're on a Workstation- or Server-based machine with IIS and the SMTP virtual server, you can send mail through the local server via the object CDONTS.NewMail.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

QwertyMonster

Im i got confused in the sloppy coding so im restarting. What is the easiest way to send an email? Thanks in advance!

Newby

Quote from: QwertyMonster on July 09, 2005, 12:07 PM
Im i got confused in the sloppy coding so im restarting. What is the easiest way to send an email? Thanks in advance!

SMTP server!
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.