Reputation: 109
I have problem with Delphi RAD Studio 10.2 and Indy component. It sends mails to gmail and hotmail address but some addresses which is private service providers email address doesn't receive any mail. I tried and it doesn't give any error message it just doesn't send it to some addresses.
Maybe it is because I don't have sender name on my IdMessage? And I set sender name but it doesn't show that in my messages.
My code is
IdMessage1.From.Name := EditNimi.Text;
IdMessage1.From.Text := EditNimi.Text;
IdMessage1.From.Address := EditOsoite.Text;
IdMessage1.Recipients.EmailAddresses := strArray[i];
temp := strArray[i];
IdMessage1.Subject := EditOtsikko.Text;
Memo := TStringList.Create;
Memo.Assign(MemoViesti.Lines);
for o := 0 to Memo.Count-1 do
begin
IdMessage1.Body.Add(Memo.Strings[o])
end;
try
try
IdSMTP1.Connect;
IdSMTP1.Send(IdMessage1);
IdMessage1.Clear;
Sleep(1000);
//IdMessage1.Free;
except on E:Exception do begin
ShowMessage('Virhe lähetettäessä');
ShowMessage('There was an error: ' + E.Message);
//StatusMemo.Lines.Insert(0, 'ERROR: ' + E.Message) ;
end;
end;
finally if IdSMTP1.Connected then begin IdSMTP1.Disconnect; end; end;
Upvotes: 0
Views: 1002
Reputation: 597961
If TIdSMTP
is not raising an exception, then no error is occurring. The immediate SMTP server you are connected to has agreed to send the email to each recipient, which may involve forwarding the email to other SMTP servers after your current SMTP session is over. Delivery errors during those forwards cannot be reported to your SMTP code, they are delivered to the inbox of your sender email instead. You need to check that inbox for delivery errors.
Upvotes: 2
Reputation: 111
Best bet is that your code is working fine but that the Email Server is declining the incoming mail rather.. But before that, investigate with the private service provider if you need to add SSL or any other security to your email for the server to accept the incoming mail beforehand. Gmail is already very specific, if your emails are going through to Gmail, rather look at the private service provider.
Upvotes: 0