1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
| <html>
<head>
<HTA:APPLICATION
ICON="http://mail.google.com/favicon.ico"
APPLICATIONNAME = "SMTP GMail Client"
BORDER="dialog"
BORDERSTYLE="complex"
CONTEXTMENU="no"
SYSMENU="yes"
Scroll="No"
MAXIMIZEBUTTON="no"
SCROLL="no"
>
<title>SMTP GMail Client © Hackoo</title>
<META HTTP-EQUIV="MSThemeCompatible" CONTENT="YES">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
body{
background-color: lightblue;
}
label,.btn{
font-weight: bold;
}
</style>
<script language="VBScript">
Const cdoSendUsingPickup = 1
Const cdoSendUsingPort = 2 'Must use this to use Delivery Notification
Const cdoAnonymous = 0
Const cdoBasic = 1 ' clear text
Const cdoNTLM = 2 'NTLM
'Delivery Status Notifications
Const cdoDSNDefault = 0 'None
Const cdoDSNNever = 1 'None
Const cdoDSNFailure = 2 'Failure
Const cdoDSNSuccess = 4 'Success
Const cdoDSNDelay = 8 'Delay
Const cdoDSNSuccessFailOrDelay = 14 'Success, failure or delay
messageSSLHTML = "<center><font size=4 FACE=Comic sans MS style=font-weight:bold Color=red Color=red>Ceci est un exemple de message en HTML.<br>Il a été envoyé en utilisant l'authentification SMTP et SSL.<br><br>"
Signature = "<center><font size=10 FACE=Comic sans MS style=font-weight:bold Color=red><br>©<br><img src=http://mail.google.com/favicon.ico>"
Sub ViaGmail
'Formater le textaera au format html pour contourner le problème du message qui s'affiche sur une seule ligne
Dim Login,Password,st,i,tb,f1,paragraphe
st=txtbody.value
tb = split(st,vbcrlf)
For i = lbound(tb) to ubound(tb)
paragraphe=paragraphe & tb(i) & "<br>" & vbcrlf
Next
f1 = file.Value
Login = txtFrom.value
Password = Pass.value
GmailBox=MsgBox ("Envoi avec ces Options:" & vbCrLf &"Expéditeur :"& Login & vbCrLf & "Destinataire : "& txtTo.Value & vbCrLf & "Sujet :" & txtSubject.Value & vbCrLf & "FileAttach1 :"& f1 ,vbYesNo+64,"Message Options")
If GmailBox = vbYes Then
if SendGmailSSL(Login,Password, txtTo.Value, txtSubject.Value, paragraphe+messageSSLHTML+Signature,f1)= 0 Then
MsgBox "Le Mail a été envoyé avec succès !",vbInformation ,"Information"
Else
MsgBox "Echec d'envoi du Mail !",vbExclamation ,"Information"
End If
End If
End Sub
Function SendGmailSSL( sFrom, sPassword, sTO ,sSubject, sBody, sFilePath1)
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = sSubject
objMessage.From = sFrom
objMessage.To = sTO
objMessage.HTMLBody = sBody
If sFilePath1 <> "" Then
objMessage.AddAttachment sFilePath1
End If
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = sFrom
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = sPassword
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
objMessage.Configuration.Fields.Update
On Error Resume Next
objMessage.Send
SendGmailSSL = Err.Number
If Err.Number <> 0 Then
MsgBox Err.Description, 16, "SendGmailSSL Erreur"
End If
End Function
Sub window_onload()
CenterWindow 420, 600
End Sub
Sub CenterWindow(x,y)
window.resizeTo x, y
iLeft = window.screen.availWidth/2 - x/2
itop = window.screen.availHeight/2 - y/2
window.moveTo ileft, itop
End Sub
</script>
</head>
<body>
<label for="Expéditeur" style="width: 120; textalign: right;">Expéditeur:</label><input type="text" id="txtFrom" name="Expéditeur" value="Expéditeur@gmail.com"><br />
<label for="txtSMTPSERVER" style="width: 120; textalign: right;">Password:</label><input type="Password" id="Pass" name="Pass"><br />
<label for="to" style="width: 120; textalign: right;">Destinataire:</label><input type="text" id="txtTo" name="to" value="Destinataire@gmail.com"><br />
<label for="subject" style="width: 120; textalign: right;">Sujet:</label><input type="text" id="txtSubject" name="sujet" value="Sujet"><br />
<label for="file">Pièce-Jointe :</label><br />
<input type="file" name="file" id="file" /><br>
<label>Message:</label><br />
<textarea id="txtBody" rows="20" cols="45"></textarea><br><br>
<center>
<input type="button" value="Envoyer Via Gmail" onClick="ViaGmail">
</body>
</html> |
Partager