I have an e-mail sender here but it is not working. I don't know if the mistake is on the SMTP adresses or on the code. Does anyone know the SMTP of yahoo and the hotmail? Thank you



.386
.MODEL FLAT, STDCALL
LOCALS @@

EXTRN WSAStartup :PROC
EXTRN socket :PROC
EXTRN gethostbyname :PROC
EXTRN htons :PROC
EXTRN connect :PROC
EXTRN closesocket :PROC
EXTRN WSACleanup :PROC
EXTRN ExitProcess :PROC
EXTRN closesocket :PROC
EXTRN WSACleanup :PROC
EXTRN MessageBoxA :PROC
EXTRN ExitProcess :PROC
EXTRN recv :PROC
EXTRN lstrlen :PROC
EXTRN send :PROC

INCLUDE TOOLS\W32.INC

.DATA

; ------------------------- INFORMA??O DO SMTP -------------------------
;
INICIAR DB "HELO pop3.yahoo.com", 13, 10, 0
ORIGEM DB "MAIL FROM:<dcba@yahoo.com>", 13, 10, 0
DESTINO DB "RCPT TO:<abcd@hotmail.com>", 13, 10, 0
DADOS DB "DATA", 13, 10, 0
FECHAR DB "RSET", 13, 10, 0
SAIR DB "QUIT", 13, 10, 0
TEXTO DB 13, 10, "Mensagem enviada pelo", 13, 10
DB "programa do Rodrigo !", 13, 10, '.', 13, 10, 0
;
; ---------------------------------------------------------------------

hSOCKET DD ?, 0
SMTP DB "pop3.hotmail.com", 0
BUFFER DB 501 DUP(0)

rs221 DB "221 ", 0
rs250 DB "250 ", 0
rs354 DB "354 ", 0

ERRO DB "Erro ", 0
CERTO DB "Tudo bem !", 0

ALIGN 4
WSADATA STRUC
wVersion DW ?
wHighVersion DW ?
szDescription DB 257 DUP(?)
szSystemStatus DB 129 DUP(?)
iMaxSockets DW ?
iMaxUdpDg DW ?
lpVendorInfo DD ?
WSADATA ENDS
WSD WSADATA <>

ALIGN 4
SOCKADDR_IN STRUC
sin_family DW ?
sin_port DW ?
sin_addr DD ?
sin_zero DB 8 DUP(?)
SOCKADDR_IN ENDS
SIN SOCKADDR_IN <AF_INET,?,?,?>

.CODE

MAIN PROC

; --------------------------------------------- 0

PUSH OFFSET WSD
PUSH 101h
CALL WSAStartup
TEST EAX, EAX
JZ @@1

PUSH 48
JMP FIM

; --------------------------------------------- 1

@@1: PUSH 0
PUSH SOCK_STREAM
PUSH AF_INET
CALL socket
CMP EAX, INVALID_SOCKET
JNE @@2

PUSH 49
JMP FIM

@@2: MOV [hSOCKET], EAX

; --------------------------------------------- 2

PUSH OFFSET SMTP
CALL gethostbyname
TEST EAX, EAX
JNZ @@3

PUSH 50
JMP FIM

@@3: MOV EBX, EAX
MOV EBX, [EBX + 12]
MOV EBX, [EBX]
MOV EAX, [EBX]
MOV [SIN.sin_addr], EAX

PUSH 25
CALL htons
MOV [SIN.sin_port], AX

; --------------------------------------------- 3

PUSH 16
PUSH OFFSET SIN
PUSH [hSOCKET]
CALL connect
CMP EAX, SOCKET_ERROR
JNE @@4

PUSH 51
JMP FIM

@@4: CALL RESPOSTAS

CMP EAX, " 022"
JNE FIM

; --------------------------------------------- 4

MOV EAX, DWORD PTR [rs250]

PUSH EAX
PUSH OFFSET INICIAR
CALL ENVIAR_RECEBER
TEST EAX, EAX
JZ @@5

PUSH 52
JMP FIM

; --------------------------------------------- 5

@@5: MOV EAX, DWORD PTR [rs250]

PUSH EAX
PUSH OFFSET ORIGEM
CALL ENVIAR_RECEBER
TEST EAX, EAX
JZ @@6

PUSH 53
JMP FIM

; --------------------------------------------- 6

@@6: MOV EAX, DWORD PTR [rs250]

PUSH EAX
PUSH OFFSET DESTINO
CALL ENVIAR_RECEBER
TEST EAX, EAX
JZ @@7

PUSH 54
JMP FIM

; --------------------------------------------- 7

@@7: MOV EAX, DWORD PTR [rs354]

PUSH EAX
PUSH OFFSET DADOS
CALL ENVIAR_RECEBER
TEST EAX, EAX
JZ @@8

PUSH 55
JMP FIM

; --------------------------------------------- 8

@@8: MOV EAX, DWORD PTR [rs250]

PUSH EAX
PUSH OFFSET TEXTO
CALL ENVIAR_RECEBER
TEST EAX, EAX
JZ @@9

PUSH 56
JMP FIM

; --------------------------------------------- 9

@@9: MOV EAX, DWORD PTR [rs250]

PUSH EAX
PUSH OFFSET FECHAR
CALL ENVIAR_RECEBER
TEST EAX, EAX
JZ @@10

PUSH 57
JMP FIM

; --------------------------------------------- 10

@@10: MOV EAX, DWORD PTR [rs221]

PUSH EAX
PUSH OFFSET SAIR
CALL ENVIAR_RECEBER
TEST EAX, EAX
JZ @@11

PUSH 58
JMP FIM

; --------------------------------------------- 11

@@11: PUSH [hSOCKET]
CALL closesocket

CALL WSACleanup

PUSH MB_OK
PUSH OFFSET CERTO
PUSH OFFSET CERTO
PUSH 0
CALL MessageBoxA

PUSH 0
CALL ExitProcess
MAIN ENDP

; ---------------------------------------------

FIM: POP EAX
MOV [ERRO + 5], AL

PUSH [hSOCKET]
CALL closesocket

CALL WSACleanup

PUSH MB_OK
PUSH OFFSET ERRO
PUSH OFFSET ERRO
PUSH 0
CALL MessageBoxA

PUSH 0
CALL ExitProcess

; ---------------------------------------------
RESPOSTAS PROC
; ---------------------------------------------
MOV EDI, OFFSET BUFFER
XOR EAX, EAX
MOV ECX, 501
CLD

REP STOSB

PUSH 0
PUSH 500
PUSH OFFSET BUFFER
PUSH [hSOCKET]
CALL recv
CMP EAX, SOCKET_ERROR
JE FIM

MOV EAX, DWORD PTR [BUFFER]
RET
RESPOSTAS ENDP
; ---------------------------------------------
;
; ---------------------------------------------
ENVIAR_RECEBER PROC
ARG PACK:DWORD, COND:DWORD
; ---------------------------------------------
PUSH EBX
MOV EBX, [COND]

PUSH [PACK]
CALL lstrlen

PUSH 0
PUSH EAX
PUSH [PACK]
PUSH [hSOCKET]
CALL send
CMP EAX, SOCKET_ERROR
JE FIM

CALL RESPOSTAS
CMP EAX, EBX
JNE @@1

POP EBX
XOR EAX, EAX
RET

@@1: POP EBX
MOV EAX, 1
RET
ENVIAR_RECEBER ENDP
; ---------------------------------------------

END MAIN
Posted on 2004-09-19 18:41:28 by Marginais
it's definitely not pop3.hotmail.com, you have to find the mx servers - mx1.hotmail.com, etc.
Posted on 2004-09-19 18:55:28 by Drocon
I've already tried everything - SMTP, POP3, none - but what are these mx servers?
Posted on 2004-09-19 19:05:34 by Marginais
Most MTAs lookup the domain part ( the part after the @ ) of the e-mail address every
time.



.data
szHostName db "yahoo.com",0
.code
invoke gethostbyname,addr szHostName


Regards, P1 8)
Posted on 2004-09-20 14:03:08 by Pone
use pop.skynet.be this one is almost all the time online and you don't need a password to connect to it (i believe so)
Posted on 2004-11-22 18:52:01 by raidu
To get MX servers, you have to a special DNS look-up.

I have source, but it is for FASM (attached).
Posted on 2004-11-22 19:05:46 by comrade