1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram

  5. Delphifan Magazine
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Ques/Help/Req Gmail Sender Example Needed

Discussion in 'Delphi Help&Requests' started by stack, Aug 4, 2019.

  1. stack
    Offline

    stack DF Member

    is there any sample that can send mail through gmail?
    other smtp website works with indy but gmail no.
     
  2. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

  3. stack
    Offline

    stack DF Member

    that does not work dear admin
     
  4. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

    Ok i show you other way but you need component

    https://www.emailarchitect.net/webapp/download/easendmail.exe (free for test)

    After installation this code is enough

    Code:
    unit Unit1;
    interface
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, EASendMailObjLib_TLB; // add EASendMail unit
    type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    var
      Form1: TForm1;
    implementation
    {$R *.dfm}
    procedure TForm1.Button1Click(Sender: TObject);
    var
      oSmtp : TMail;
    begin
      oSmtp := TMail.Create(Application);
      oSmtp.LicenseCode := 'TryIt';
    
      // Your Gmail email address
      oSmtp.FromAddr := [email protected]';
    
      // Add recipient email address
      oSmtp.AddRecipientEx( '[email protected]', 0);
    
      // Set email subject
      oSmtp.Subject := 'simple email from gmail account';
    
      // Set email body
      oSmtp.BodyText := 'this is a test email sent from Delphi using Gmail';
    
      // Gmail SMTP server address
      oSmtp.ServerAddr := 'smtp.gmail.com';
    
      // set direct SSL 465 port,
      oSmtp.ServerPort := 465;
    
      // detect SSL/TLS automatically
      oSmtp.SSL_init();
    
      // Gmail user authentication should use your
      // Gmail email address as the user name.
      // For example: your email is "[email protected]", then the user should be "[email protected]"
      oSmtp.UserName := '[email protected]';
      oSmtp.Password := 'yourpassword';
    
      ShowMessage( 'start to send email ...' );
      if oSmtp.SendMail() = 0 then
        ShowMessage( 'email was sent successfully!' )
      else
        ShowMessage( 'failed to send email with the following error: '
        + oSmtp.GetLastErrDescription());
    end;
    end.
     

Share This Page