eMail with html

eMail with html

Postby D.Fernandez » Fri Sep 22, 2023 11:27 pm

Hello friends.
I'm trying to send an eMail with html format, but I can't. Any help, please.

cText := <!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Resúmen de cuenta</title>
</head>
<body>

</body>
</html>



DEFINE MAIL oMail ;
SUBJECT "Mejoras para Ud." ;
TEXT cTEXT ;
TO cCorreo ;
FROM USER

ACTIVATE MAIL oMail

Muchas gracias
Saludos

Ruben Dario Fernandez
Dario Fernandez
FWH 24.09, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
D.Fernandez
 
Posts: 466
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay

Re: eMail with html

Postby Jimmy » Sun Sep 24, 2023 9:38 pm

hi,

i have read "somewhere"
There is an undocumented feature of MAPISendMail for including an HTML body:

Code: Select all  Expand view
   set lpszNoteText to nil (or a pointer to an empty string)
    add an HTML attachment

MAPI will use the html attachment as the body of the e-mail (and not include the attachment).

---
Officially, Simple MAPI does not support HTML.

If you however set the message body to NULL (not just an empty string), and
the very first attachment is an HTML file, the outgoing message will be HTML
populated from the atttachment data. I don't know whether this is a bug or a
feature.

Code: Select all  Expand view
m_pMessage->lpszNoteText = NULL;
m_pMessage->lpszMessageType = "IPM.Note";
m_pMessage->lpszConversationID = NULL; // <-- set to null


---
as TEXT point to lpszNoteText try NIL or NULL
DEFINE MAIL [<oMail>] ;
[ SUBJECT <cSubject> ] ;
[ TEXT <cText> ] ;
[ TYPE <cType> ] ;

and add a HTML as Attachment
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: eMail with html

Postby rubenfernandez01 » Sun Sep 24, 2023 10:53 pm

Thanks very much Jimmy.

Saludos
Ruben Dario Fernandez

Enviado desde mi 21081111RG mediante Tapatalk
rubenfernandez01
 
Posts: 46
Joined: Sun Sep 20, 2015 1:41 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests