The demo sending email crashes
Posted: Tue Mar 01, 2016 4:46 pm
I have downloaded the trial version of the product and I have now seen that it doesn't work with sending mail via outlook. So I had a look at Mime Demo and sending with Indy (we are using Indy 10). Unfortunately the demo crashes when I try to send the default message. I am using Delphi 7. Here is the code from BuildEmail:
txtpart := TIdText.Create(IdMessage1.MessageParts);
Stream := TMemoryStream.Create;
RichViewEdit1.SaveTextToStreamW('', Stream, 80, False, False);
Stream.Position := 0;
SetLength(ws, Stream.Size div 2);
if Stream.Size<>0 then
Stream.ReadBuffer(Pointer(ws)^, Stream.Size);
Stream.Free;
txtpart.Body.Text := ws;
It crashes when you set the body. However, when debugging, there is rubbish in ws.
txtpart := TIdText.Create(IdMessage1.MessageParts);
Stream := TMemoryStream.Create;
RichViewEdit1.SaveTextToStreamW('', Stream, 80, False, False);
Stream.Position := 0;
SetLength(ws, Stream.Size div 2);
if Stream.Size<>0 then
Stream.ReadBuffer(Pointer(ws)^, Stream.Size);
Stream.Free;
txtpart.Body.Text := ws;
It crashes when you set the body. However, when debugging, there is rubbish in ws.