PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 25 → Enviar email com HTML personalizado
Enviar email com HTML personalizado
Débuté par TOM SILVA / RMT SYST, 26 fév. 2016 00:41 - Aucune réponse
Membre enregistré
7 messages
Popularité : +2 (2 votes)
Posté le 26 février 2016 - 00:41
Para fazer o codigo html foi usado o software Kompozer

http://www.kompozer.net/

software e gratuito e ajuda de forma visual a criar o corpo do email.


// Summary: <specify the procedure action>
// Syntax:
//EnviaMail ()
//
// Parameters:
// None
// Return Value:
// None
//
// For instance:
// Indicate an example.
//
Procedure EnviaMail()

UserName is string
UserName = "reservas@empresa.com"

IF EmailStartSMTPSession(UserName, "sua senha aqui", ...
"ssd.serversecureplusplusalekito.net",465, False,optionSSL) = True THEN

Destinatario, Assunto, sAnexo is string

Destinatario = "Reservas@empresa.com"
Assunto = "Nueva Reserva en el sitio web de : (" + EDT_Nombre + ")"

Corpo is string =[
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>Email</title>
</head>
<body>
<span style="font-weight: bold;">Detalles de la Reserva<br>
</span>
<table
style="text-align: left; background-color: rgb(102, 204, 204); width: 360px; height: 284px;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td><span style="font-weight: bold;"> <span
style="color: white;">Nombre :</span> </span></td>
<td><span style="font-weight: bold;"><span
style="color: white;">%1</span> </span></td>
</tr>
<tr>
<td style="color: white;"><span
style="font-weight: bold;">Correo:  </span></td>
<td style="color: white;"><span
style="font-weight: bold;">%2</span></td>
</tr>
<tr>
<td><span style="font-weight: bold;"><span
style="color: white;">Teléfono:</span> </span></td>
<td style="color: white;"><span
style="font-weight: bold;"> %3</span></td>
</tr>
<tr>
<td style="color: white;"><span
style="font-weight: bold;">Fehca Viaje:</span></td>
<td style="color: white;"><span
style="font-weight: bold;">%4</span></td>
</tr>
<tr>
<td style="color: white;"><span
style="font-weight: bold;">Hora Viaje :</span></td>
<td style="color: white;"><span
style="font-weight: bold;">%5</span></td>
</tr>
<tr>
<td style="color: white;"><span
style="font-weight: bold;">Origem: </span></td>
<td style="color: white;"><span
style="font-weight: bold;"> %6</span></td>
</tr>
<tr>
<td><span style="font-weight: bold;"><span
style="color: white;">Destino:  </span> </span></td>
<td style="color: white;"><span
style="font-weight: bold;">%7</span></td>
</tr>
<tr>
<td style="color: white;"><span
style="font-weight: bold;">Total Adultos:</span></td>
<td style="color: white;"><span
style="font-weight: bold;">%8</span></td>
</tr>
<tr>
<td style="color: white;"><span
style="font-weight: bold;">Total de Niños:</span></td>
<td style="color: white;"><span
style="font-weight: bold;">%9</span></td>
</tr>
<tr>
<td style="color: white;"><span
style="font-weight: bold;">Observaciones:</span></td>
<td style="color: white;"><span
style="font-weight: bold;">% 10</span></td>
</tr>
</tbody>
</table>
<span style="font-weight: bold;"><br>
<br>
<br>
</span><span style="font-weight: bold;">Sistema d</span><span
style="font-weight: bold;"></span><span
style="font-weight: bold;">e reservas en linea Transmacuchi</span><br>
<span style="font-weight: bold;"><img
style="width: 139px; height: 129px;" alt="Transmacuchi"
title="Logo"
src="http://www.transmacuchi.com/efactura_web/es/index.awp?WD_ACTION_=IMAGE&M31=2&AWPID=AF8FBAFC4226C77C51ECF7A72A7E5E5C01D08187"></span><span
style="font-weight: bold;"></span><span
style="font-weight: bold;"></span>
</body>
</html>

]

MyArray is array of 10 string
MyArray[1] = EDT_Nombre
MyArray[2] = EDT_MAIL
MyArray[3] = EDT_TEL
MyArray[4] = DateToString(EDT_FECHA,"DD/MM/YYYY")
MyArray[5] = TimeToString(EDT_HORA,"HH:MM:SS")
MyArray[6] = COMBO_ORIGEN..StoredItem
MyArray[7] = COMBO_DESTINO..StoredItem
MyArray[8] = COMBO_ALDULTOS..StoredItem
MyArray[9] = COMBO_NINOS..StoredItem
MyArray[10] = EDT_OBSERV


Mensaje is string = StringBuild(Corpo,MyArray)


//INICIA A ESTRUTURA DO E-MAIL
MonMessage est un Email
MonMessage..Expediteur = "reservas@empresa.com"
Ajoute(MonMessage..Destinataire, Destinatario)

MonMessage..HTML = Mensaje
MonMessage..AccuséRéception = Vrai
MonMessage..Sujet = Assunto

IF sAnexo <> " " THEN
//EmailLoadAttachment(MonMessage,Anexo)
END

//ENVIA O E-MAIL
IF EmailSendMessage(UserName, MonMessage) = False THEN
Error()
ELSE
Info("Mensaje enviada con suceso!")
END





EmailCloseSession(UserName)

ELSE

Error("Unable to establish connection", ErrorInfo(), ...
"In case of time-out, check the parameters of the "+ ...
"""Firewall"" on the port used (587)")
END


Agradeço ao Willian pela colaboração...
Message modifié, 26 février 2016 - 03:27