Sending HTML emails (1 Viewer)

Poussin

New member
Local time
Yesterday, 18:45
Joined
Mar 22, 2011
Messages
8
Hi all,

I've been using Access to send emails for quite a while now, using either sendObject or shell instructions sent to Thunderbird (when i needed attachments).
The body of my messages where imported from a txt file using the following code :

Code:
Public Function strLecture(ByVal cheminFile As String) As String
' To read a text file
    On Error GoTo E_Handle
    Dim nbeCar As Long
    Dim LecFile As Integer
    LecFile = FreeFile
    Open cheminFile For Input As LecFile
    nbeCar = LOF(LecFile)
    strLecture = Input(nbeCar, LecFile)
sExit:
    On Error Resume Next
    Reset
    Exit Function
E_Handle:
    MsgBox Err.Description, vbOKOnly + vbCritical, "Error: " & Err.Number
    Resume sExit
End Function
This works fine with plain text files, but it fails to read a html file. I get the following error : "input past end of file".
Any hint?

Cheers!
 

Poussin

New member
Local time
Yesterday, 18:45
Joined
Mar 22, 2011
Messages
8
Apparently the "Open ... for Input" method doesn't work with Unicode txt files. It must be ANSI.
A html file not encoded as unicode can be read with the "Open...Input method".

Putting the resulting string into the body of an email using SendObject is apparently not the way to go, as SendObject kindly uses "HTML Tidy for Windows (vers 14 February 2006)". It messes up all the code.

Not solved yet...
 

Users who are viewing this thread

Top Bottom