infussolucoes / usercontrol-sd

Versão dos Componentes User Control mantido pela Comunidade Show Delphi
https://showdelphi.com.br
Other
60 stars 39 forks source link

ajuste na função EnviaEmailTp #8

Closed Emers0n closed 5 years ago

Emers0n commented 7 years ago

Function TMailUserControl.EnviaEmailTp(Nome, Login, USenha, Email, Perfil: String; UCMSG: TUCMailMessage): Boolean; var MailMsg: TAlSmtpClient;

{$IF CompilerVersion >= 23} MailRecipients: TALStringList; MailHeader: TALEmailHeader; {$ELSE} MailRecipients : TStringlist; MailHeader : TALSMTPClientHeader; {$IFEND} begin Result := False; if Trim(Email) = '' then Exit; MailMsg := TAlSmtpClient.Create;

{$IF CompilerVersion >= 23} // MailMsg.OnStatus := OnStatus; MailRecipients := TALStringList.Create; MailHeader := TALEmailHeader.Create; {$ELSE} MailMsg := TAlSmtpClient.Create; MailMsg.OnStatus := OnStatus; MailRecipients := TStringlist.Create; {$IFEND}

MailHeader.From := EmailRemetente; MailHeader.SendTo := Email; MailHeader.ContentType := 'text/html'; MailRecipients.Append(Email); MailHeader.Subject := UCMSG.Titulo;

try try UCEMailForm := TUCEMailForm.Create(Self); UCEMailForm.lbStatus.Caption := ''; UCEMailForm.Show; UCEMailForm.Update;

  MailMsg.SendMail(ServidorSMTP, FPorta, EmailRemetente, MailRecipients,
    Usuario, Senha, fAuthType, MailHeader.RawHeaderText,
    ParseMailMSG(Nome, Login, USenha, Email, Perfil, UCMSG.Mensagem.Text));

  UCEMailForm.Update;
  Result := True;
except
  on e: Exception do
  begin
    UCEMailForm.Close;
    MessageDlg(e.Message, mtWarning, [mbok], 0);
    raise;
  end;
end;

finally FreeAndNil(MailMsg); FreeAndNil(MailHeader); FreeAndNil(MailRecipients); FreeAndNil(UCEMailForm); end; end;

infussolucoes commented 7 years ago

Olá, não entendemos o problema. Podes passar mais detalhes?

Emers0n commented 7 years ago

A variável MailRecipients era do tipo talstrings mudei para talstringlist pois ao utilizar o metodo getcount enviando email estava dando a MSG de abstract error

Emers0n commented 7 years ago

A variável MailRecipients era do tipo talstrings mudei para talstringlist pois ao utilizar o metodo getcount enviando email estava dando a MSG de abstract error

infussolucoes commented 7 years ago

Certo, vamos aplicar ao projeto.

infussolucoes commented 7 years ago

Emers0n, subimos hoje as alterações.

Se puder, atualize seus fontes e verifique se a mesma foi aplicada. Desde já agradecemos pela contribuição!

infussolucoes commented 5 years ago

Ajuste já aplicado.