Mailgun 'mailer' not defined error issue

I am getting name ‘mailer’ not defined in the program for mailgun. Am I suppose to define it? can’t crack the error, kindly help. Thank You.

@aaazann You have defined the object as email, please replace mailer with email and it should work.

replace mailer.send_email by email.send_email because you have created object as named email otherwise you can replace email by mailer in line number 2