EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SMTP Send

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#12351
Posted: 02/09/2010 23:57:49
by Eugene Marmiy (Basic support level)
Joined: 05/06/2009
Posts: 26

Hello.
I am trying send, but getting an error:

Quote
for command MAIL FROM:<myemail@gmail.com> SIZE=326 (error code is 530)

Code
var
  smtp: TElSMTPClient;
  MailMessage: TElMessage;
begin
  StatusMemo.Clear;
  //setup SMTP
  smtp := TElSMTPClient.Create(Owner);
  SMTP.Address := ledHost.Text;
  SMTP.Port := 587;
  smtp.SSLMode := smExplicit;
  MailMessage := TElMessage.Create();
  MailMessage.From.AddAddress(ledFrom.Text, ledFrom.Text);
  MailMessage.To_.AddAddress(ledTo.Text, ledTo.Text);
  MailMessage.SetSubject(ledSubject.Text);
  MailMessage.SetMessageID(Body.Text);
  try
    try
      SMTP.Username := 'MyEmail@gmail.com';
      SMTP.Password := 'MyPassword';

      smtp.Open;
      smtp.Login('smtp.gmail.com');

      SMTP.Send(MailMessage);
    except on E:Exception do
      StatusMemo.Lines.Insert(0, 'ERROR: ' + E.Message);
    end;
  finally
    if SMTP.Active then SMTP.Close;
    smtp.Free;
  end;


PS: Through delphi\indy10 a sended, but for it is necessary *.dll

What need else?
Thank you.
#12353
Posted: 02/10/2010 00:42:10
by Eugene Mayevski (EldoS Corp.)

1) In Login method you must provide the host name of *your* computer. You are not smtp.gmail.com and the server denies your connection.
2) GMail requires use of TLS. I don't remember the details exactly, but if memory serves, you need to connect to port 495 of SMTP server using implicit TLS.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 867 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!