Accueil > > > ENVOIT MAIL MASM32
ENVOIT MAIL MASM32
Information sur la source
Description
Permet d'envoyer un mail grace a winsock
Source
- ;MASM32
-
- .486
- .model flat,stdcall
- option casemap:none
-
-
- include \masm32\include\windows.inc
- include \masm32\include\masm32.inc
- include \masm32\include\wsock32.inc
- include \masm32\include\user32.inc
- include \masm32\include\kernel32.inc
- includelib \masm32\lib\user32.lib
- includelib \masm32\lib\kernel32.lib
- includelib \masm32\lib\wsock32.lib
- includelib \masm32\lib\masm32.lib
-
- Mys PROTO :DWORD
-
- .DATA
-
- SMTP db "195.238.3.128",0 ;IP du srv smtp.infonie.be
-
- HELO db "HELO smtp.infonie.be",13 ,10 ,0
- MAIL_FROM db "MAIL FROM:dequi@cavien.fr",13 ,10 ,0
- RCPT_TO db "RCPT TO:personne@quituvxenvoyer.com",13 ,10 ,0
- DONNEES db "DATA",13 ,10 ,0
- TEXTE db "Hello world !",13 ,10 ,13 ,10 ,0
- FIN_DONNEES db ".",13 ,10 ,0
-
- FERME db "QUIT",13 ,10 ,0 ;fini la connection
- ;smtp
-
- wsadata WSADATA <> ;pour la structure du socket
- sin sockaddr_in <>
- Port dd 25 ;port smtp
-
- .DATA?
-
- sock dd ? ;pour la structure du socket
- buf db 255 dup (?) ;buffer pour le MessageBox
-
-
-
- .CODE
- start:
-
- invoke WSAStartup,101h,addr wsadata ;initialise le socket
- invoke socket,AF_INET,SOCK_STREAM,IPPROTO_IP
- mov sock,eax
- mov sin.sin_family,AF_INET ;famille de socket
- invoke htons,Port ;port 25
- mov sin.sin_port,ax
- invoke inet_addr, addr SMTP ;ip du smtp
- mov sin.sin_addr, eax
-
- invoke connect, sock, addr sin ,sizeof sin ;on se connecte
- invoke recv, sock, addr buf, sizeof buf, 0 ;et affiche la reponse
-
- ; HELO SERVER
- invoke Mys, addr HELO ;envoit HELO smtp.infonie.be
- invoke recv, sock, addr buf, sizeof buf, 0
- invoke MessageBox,0,addr buf, addr HELO, MB_OK
-
- ; MAIL TO:
- invoke Mys, addr MAIL_FROM ;envoit MAIL FROM:
- invoke recv, sock, addr buf, sizeof buf, 0
- invoke MessageBox,0,addr buf, addr MAIL_FROM, MB_OK
-
- ; RCPT TO:
- invoke Mys, addr RCPT_TO ;envoit RCPT TO:
- invoke recv, sock, addr buf, sizeof buf, 0
- invoke MessageBox,0,addr buf, addr RCPT_TO, MB_OK
-
- ; DATA
- invoke Mys, addr DONNEES ;envoit DATA
- invoke recv, sock, addr buf, sizeof buf, 0
- invoke MessageBox,0,addr buf, addr DONNEES, MB_OK
-
- invoke Mys, addr TEXTE ;envoit le text
-
- ; DATA
- invoke Mys, addr FIN_DONNEES ;envoit .
- invoke recv, sock, addr buf, sizeof buf, 0
- invoke MessageBox,0,addr buf, addr FIN_DONNEES, MB_OK
-
-
- ; DATA
- invoke Mys, addr FERME ;envoit QUIT
- invoke recv, sock, addr buf, sizeof buf, 0
- invoke MessageBox,0,addr buf, addr FERME, MB_OK
-
-
- invoke closesocket,sock ;ferme le socket et quit
- invoke WSACleanup
- invoke ExitProcess,eax
-
- ;---------------------------------------
-
- Mys proc SendStr : DWORD
-
- push edi
- mov edi, SendStr
- .WHILE TRUE
- .BREAK .IF (byte ptr [edi] == 0 )
- invoke send, sock, edi, 1, 0
- inc edi
- .ENDW
- pop edi
- ret
- Mys endp
-
- END start
;MASM32
.486
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\wsock32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\wsock32.lib
includelib \masm32\lib\masm32.lib
Mys PROTO :DWORD
.DATA
SMTP db "195.238.3.128",0 ;IP du srv smtp.infonie.be
HELO db "HELO smtp.infonie.be",13 ,10 ,0
MAIL_FROM db "MAIL FROM:dequi@cavien.fr",13 ,10 ,0
RCPT_TO db "RCPT TO:personne@quituvxenvoyer.com",13 ,10 ,0
DONNEES db "DATA",13 ,10 ,0
TEXTE db "Hello world !",13 ,10 ,13 ,10 ,0
FIN_DONNEES db ".",13 ,10 ,0
FERME db "QUIT",13 ,10 ,0 ;fini la connection
;smtp
wsadata WSADATA <> ;pour la structure du socket
sin sockaddr_in <>
Port dd 25 ;port smtp
.DATA?
sock dd ? ;pour la structure du socket
buf db 255 dup (?) ;buffer pour le MessageBox
.CODE
start:
invoke WSAStartup,101h,addr wsadata ;initialise le socket
invoke socket,AF_INET,SOCK_STREAM,IPPROTO_IP
mov sock,eax
mov sin.sin_family,AF_INET ;famille de socket
invoke htons,Port ;port 25
mov sin.sin_port,ax
invoke inet_addr, addr SMTP ;ip du smtp
mov sin.sin_addr, eax
invoke connect, sock, addr sin ,sizeof sin ;on se connecte
invoke recv, sock, addr buf, sizeof buf, 0 ;et affiche la reponse
; HELO SERVER
invoke Mys, addr HELO ;envoit HELO smtp.infonie.be
invoke recv, sock, addr buf, sizeof buf, 0
invoke MessageBox,0,addr buf, addr HELO, MB_OK
; MAIL TO:
invoke Mys, addr MAIL_FROM ;envoit MAIL FROM:
invoke recv, sock, addr buf, sizeof buf, 0
invoke MessageBox,0,addr buf, addr MAIL_FROM, MB_OK
; RCPT TO:
invoke Mys, addr RCPT_TO ;envoit RCPT TO:
invoke recv, sock, addr buf, sizeof buf, 0
invoke MessageBox,0,addr buf, addr RCPT_TO, MB_OK
; DATA
invoke Mys, addr DONNEES ;envoit DATA
invoke recv, sock, addr buf, sizeof buf, 0
invoke MessageBox,0,addr buf, addr DONNEES, MB_OK
invoke Mys, addr TEXTE ;envoit le text
; DATA
invoke Mys, addr FIN_DONNEES ;envoit .
invoke recv, sock, addr buf, sizeof buf, 0
invoke MessageBox,0,addr buf, addr FIN_DONNEES, MB_OK
; DATA
invoke Mys, addr FERME ;envoit QUIT
invoke recv, sock, addr buf, sizeof buf, 0
invoke MessageBox,0,addr buf, addr FERME, MB_OK
invoke closesocket,sock ;ferme le socket et quit
invoke WSACleanup
invoke ExitProcess,eax
;---------------------------------------
Mys proc SendStr : DWORD
push edi
mov edi, SendStr
.WHILE TRUE
.BREAK .IF (byte ptr [edi] == 0 )
invoke send, sock, edi, 1, 0
inc edi
.ENDW
pop edi
ret
Mys endp
END start
Conclusion
visite http://www.passionpc.net
Historique
- 12 décembre 2004 17:17:46 :
- ajout de WSACleanup
WSACleanup permet à windows de "nettoyer" la RAM que l'on prenait avec winsock.
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
[MIX10] KEYNOTE DEUXIèME JOURNéE - INTERNET EXPLORER 9, HTML5, VISUAL STUDIO 2010, ODATA[MIX10] KEYNOTE DEUXIèME JOURNéE - INTERNET EXPLORER 9, HTML5, VISUAL STUDIO 2010, ODATA par cyril
Le deuxième keynote du mix fut très riche en contenu. Internet Explorer 9 Juste un après le lancement de Internet Explorer 8, Microsoft a dévoilé les nouveautés de Internet Explorer 9. Désormais, IE supportera HTML5, SVG et CSS3. L'élément ...
Cliquez pour lire la suite de l'article par cyril CERTIFICATIONS BETA .NET 4CERTIFICATIONS BETA .NET 4 par KooKiz
Les inscriptions pour les certifications beta .NET 4 ont commencé. L'inscription est offerte pour les examens suivants : - 71-511, TS: Windows Applications Development with Microsoft .NET Framework 4 - 71-515, TS: Web Applications Development with...
Cliquez pour lire la suite de l'article par KooKiz [MIX 2010] - MICROSOFT TRANSLATOR TECHNOLOGY PREVIEW V2[MIX 2010] - MICROSOFT TRANSLATOR TECHNOLOGY PREVIEW V2 par redo
J'imagine que la plupart d'entre vous connaissent bien et utilisent le service de traduction de Google, mais connaissez-vous celui de Microsoft . Microsoft Translator ? Effectivement, Microsoft nous annoncé le lancement version 2 de la Technologie Preview...
Cliquez pour lire la suite de l'article par redo LANCEMENT EN PREVIEW DE CYCLONE LORS DES TECHDAYS 2010!LANCEMENT EN PREVIEW DE CYCLONE LORS DES TECHDAYS 2010! par MPOWARE
Toutes les vidéos de ce lancement sont en ligne!
Partie I - Intro
http://www.youtube.com/watch?v=LkQzTQ8T6CA
Partie II - Démo 1
http://www.youtube.com/watch?v=drAhYQ7lqvo
Partie III - Démo 2
http://www.youtube.com/watch?v=c8KM_1Gqybc...
Cliquez pour lire la suite de l'article par MPOWARE
Forum
ASSEMBLEURASSEMBLEUR par solleil
Cliquez pour lire la suite par solleil RE : CSHARPRE : CSHARP par ghuysmans99
Cliquez pour lire la suite par ghuysmans99
Logiciels
Academy System (10.9.4.0)ACADEMY SYSTEM (10.9.4.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Xilisoft Convertisseur Vidéo Ultimate (5.1.39.0305)XILISOFT CONVERTISSEUR VIDéO ULTIMATE (5.1.39.0305)Xilisoft Convertisseur Vidéo Ultimate est un outil puissant de conversion vidéo, facile à utilise... Cliquez pour télécharger Xilisoft Convertisseur Vidéo Ultimate Xilisoft DVD Ripper Ultimate (5.0.64.0304)XILISOFT DVD RIPPER ULTIMATE (5.0.64.0304)Xilisoft DVD Ripper Ultimate est un logiciel excellent pour copier et convertir DVD vers presque ... Cliquez pour télécharger Xilisoft DVD Ripper Ultimate Rigs of Rods (63.3)RIGS OF RODS (63.3)c'est un jeu de multi-simulation camions,autobus voitures, avions, bateaux, hélicoptère avec défo... Cliquez pour télécharger Rigs of Rods
|