Board index » delphi » Sending Email Using Delphi 5

Sending Email Using Delphi 5

I'm using the SMTP component in Delphi 5 to send out emails. If I set the
postmessage.toaddress to my email address on the SMTP server, it works fine.
If I set the postmessage.toaddress to someone else's email address (i.e. I'm
sending email to another person), it fails with error 503 No Recipients
Specified. Looking at the Delphi help, it says the SMTP server checks the
email addresses in the to address and any that it doesn't know about, it
kicks out. Since I only have one to email address and it got kicked out, I
get the 503 error message even though the to email address is valid.

How do I get around this or can I only use Delphi to send an email to
myself? How do I send email to other people?

Gary

 

Re:Sending Email Using Delphi 5


I do this and it works fine

        try
                with Mailer.PostMessage do
                begin
                        Subject :='This subject';
                        Body.Clear;
                        Body.Add('Message line 1');
                        Body.Add('etc');

                        //setup attachments
                        Attachments.Clear;
                        Attachments.Add(fname);

                        ToAddress.Clear;
                        ToAddress.Add('f...@someplace.com');

                        Host := 'yourmailhost.com';

                        Mailer.SendMail;        
                end;
        finally
                Mailer.DisConnect;
        end;

Quote
"gary gee" <g...@socal.rr.com> wrote:
>I'm using the SMTP component in Delphi 5 to send out emails. If I set the
>postmessage.toaddress to my email address on the SMTP server, it works fine.
>If I set the postmessage.toaddress to someone else's email address (i.e. I'm
>sending email to another person), it fails with error 503 No Recipients
>Specified. Looking at the Delphi help, it says the SMTP server checks the
>email addresses in the to address and any that it doesn't know about, it
>kicks out. Since I only have one to email address and it got kicked out, I
>get the 503 error message even though the to email address is valid.

>How do I get around this or can I only use Delphi to send an email to
>myself? How do I send email to other people?

>Gary

Other Threads