troubleshooting Question

send email with outlook (from delphi-application). Send-Window does not open.

Avatar of formi
formiFlag for Switzerland asked on
DelphiOutlook
6 Comments1 Solution214 ViewsLast Modified:
Hi

using Delphi 10.1 and outlook 365.
There are only some clients where I have the problem: I can not send EMail from my application. On my computer and most other clients-computers it works. But there are computers, where only outlook is startet but no send-window is opend. Retring a second time, outlook is startet also a second time...
  OutlookApplication1.Connect;
  try
    MailItem1 := OutlookApplication1.CreateItem(olMailItem)  as _MailItem;
    while toAdress <> '' do
    begin
      if Pos(';',toAdress) > 0 then
      begin
        MailItem1.Recipients.Add(Copy(toAdress,1,Pos(';',toAdress)-1));
        Delete(toAdress,1,Pos(';',toAdress));
      end
      else
      begin
        MailItem1.Recipients.Add(toAdress);
        toAdress := '';
      end;
    end;
    MailItem1.CC := ToCC;
    MailItem1.BCC := ToBCC;
    MailItem1.Subject := Subject;
    if EMailOutlookAbsender = '' then  //local definitions?
    begin
      if Pos('@',getOptionMandantS('EMail_Absender','')) > 0 then
        MailItem1.SendUsingAccount := OutlookApplication1.Session.Accounts.Item(getOptionMandantS('EMail_Absender',''));
    end
    else MailItem1.SendUsingAccount := OutlookApplication1.Session.Accounts.Item(EMailOutlookAbsender); //globale Einstellung
    Mailitem1.BodyFormat := olFormatHTML;
    //the default signature is added
    ObjectInspector := Mailitem1.getinspector;

    if ObjectInspector.EditorType = olEditorWord then
    begin
      WordEditor := ObjectInspector.WordEditor;
      WordEditor.Characters.item(1).InsertBefore(Htmltext);
    end
    else
    begin
      Mailitem1.HtmlBody := StringReplace(Mailitem1.HtmlBody,'<body>','<body>'+Htmltext,[rfReplaceAll,rfIgnoreCase]);
    end;
    if AttachedFileNames <> nil then
    begin
      for i := 0 to AttachedFileNames.Count - 1 do
        MailItem1.Attachments.Add(AttachedFileNames[i], EmptyParam, EmptyParam, EmptyParam);
    end;
    MailItem1.Display(true);
Any idea where the problem is?
Thanks, Peter
ASKER CERTIFIED SOLUTION
Lukasz Zielinski
software developer
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros