The code from Bandy's (my) post on: April 05, 2022, 10:52:37 am, where I say: "It works fine, thanks rvk!!!" is not doing the login anymore at "if SMTP.Login then" line.
This is the code from my post on: April 05, 2022, 10:52:37 am:
uses
..., smtpsend, ssl_openssl;
function SendMail(const User, Password, MailFrom, MailTo, SMTPHost, SMTPPort, MailData: string): Boolean;
var
SMTP: TSMTPSend;
sl:TStringList;
begin
Result:=False;
SMTP:=TSMTPSend.Create;
sl:=TStringList.Create;
try
sl.text:=Maildata;
SMTP.UserName:=User;
SMTP.Password:=Password;
SMTP.TargetHost:=SMTPHost;
SMTP.TargetPort:=SMTPPort;
SMTP.AutoTLS:=true;
if SMTPPort<> '25' then
SMTP.FullSSL:=true;
if SMTP.Login then {here the login is not done ok and the mail is not send anymore}
begin
Result:=SMTP.MailFrom(MailFrom, Length(MailData)) and
SMTP.MailTo(MailTo) and
SMTP.MailData(sl);
SMTP.Logout;
end;
finally
SMTP.Free;
sl.Free;
end;
end;
// ...
if SendMail('my_username_without_yahoo.com', 'app_password', 'my_email@yahoo.com', 'user@domain.com', 'smtp.mail.yahoo.com', '465', 'Subject: test' + #13#10#13#10 + 'test') then
Memo1.Lines.Add('success')
else
Memo1.Lines.Add('error');
I changed the app password, but the mail still doesn't send.
Please help!!!