Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IdMessageClient problem
#5
Thanks, everyone!

Your responses helped me get it working on first try!

Using the TIdMessageBuilderHtml makes it super simple, unlike the demo project, which is what I based by original code from. 

Thanks!
--Stanwood

Ooops! Spoke too soon! Then email looks better, but now the file is not actually transmitted. Even looking at the 'raw content' shows no MIM encoding, just the headers. I'm sure I'm still missing a step, since the original code I was using actualy did include the MIM encoding.

  oMsg := TIdMessage.Create;
try
  oMsg.Date := Now;
  oMsg.FromList.EMailAddresses := Self.edtFrom.text
  oMsg.Subject := edtSubJect.Text;
  oMsg.Recipients.EMailAddresses := edtTo.Text;

  oMsgBldr := TIdMessageBuilderHtml.Create;
  try
    oMsgBldr.Html.Text := 'HTML goes here!';
    OMsgBldr.PlainText.Text := Memo1.Text;
    for j := 0 to lbFiles.Items.Count-1 do
      oMsgBldr.Attachments.Add(lbFiles.Items[j]);

    oMsgBldr.FillMessage(oMsg);
  finally
    oMsgBldr.Free;
  end;

  SMTP.AuthType := satDefault; {Simple Login}
  SMTP.Username := 'order@hiemstraoptical.com'; // SmtpServerUser;
  SMTP.Password := 'orderdept'; // SmtpServerPassword;

  {General setup}
  SMTP.Host := Self.SmtpServerName;
  SMTP.Port := 25; //  SmtpServerPort;

  {now we send the message}
  SMTP.Connect;
  try
      SMTP.Send(oMsg);
  finally
      SMTP.Disconnect;
  end;

finally
  oMsg.Free;
end;
Reply


Messages In This Thread
IdMessageClient problem - by scampsmith - 10-18-2021, 07:36 PM
RE: IdMessageClient problem - by rlebeau - 10-19-2021, 12:01 AM
RE: IdMessageClient problem - by Robert Gilland - 10-19-2021, 12:05 AM
RE: IdMessageClient problem - by rlebeau - 10-19-2021, 12:44 AM
RE: IdMessageClient problem - by scampsmith - 10-19-2021, 01:59 PM
RE: IdMessageClient problem - by rlebeau - 10-19-2021, 05:52 PM
RE: IdMessageClient problem - by scampsmith - 10-19-2021, 07:22 PM
RE: IdMessageClient problem - by rlebeau - 10-19-2021, 10:50 PM
RE: IdMessageClient problem - by scampsmith - 10-20-2021, 12:21 PM
RE: IdMessageClient problem - by rlebeau - 10-20-2021, 06:02 PM
RE: IdMessageClient problem - by scampsmith - 10-20-2021, 07:20 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)