-2

i have installed php mailer using composer PHPMailer/PHPMailer and i got PHPMailer-Master directory but how and what files can i include to my mail file i.e sendEmail.php.

Here is my sendEmail.php-

include 'What is include paht?'
$mail = new PHPMailer;
$mail->setFrom($email, $name);
$mail->addAddress('dev5.veomit@gmail.com', 'Admin');
$mail->Subject  = 'First PHPMailer Message';
$mail->Body     = 'Hi! This is my first e-mail sent through PHPMailer.';
  if(!$mail->send()) {
   header("Location: https://m-expressions.com/test/voy/");
    }else {
   echo 'Mailer error: ' . $mail->ErrorInfo;
   }

Please help me to complete this code. thanks in advance.

Dev5
  • 67
  • 2
  • 10
  • Have you configured everything you need for mailer to work? Check this answer https://stackoverflow.com/questions/14256582/phpmailer-smtp-configuration – Bozidar Sikanjic Jun 06 '19 at 09:54
  • i am not sure.. please guide me how i can configure the phpmailer and also i don't want to use my password for send any email. – Dev5 Jun 06 '19 at 09:59
  • It might be helpful to you https://www.sitepoint.com/sending-emails-php-phpmailer/ – Dhruv Jun 06 '19 at 10:02
  • Check the links above, it will give you idea what and where to look but first find and read how email works, what is SMTP protocol, IMAP, POP3, mail server... to understand what are you actually coding. If you accepted it as "blackboxed" and "something library does for me" you will encounter a lot more problems in the future. – Bozidar Sikanjic Jun 06 '19 at 10:07

1 Answers1

0

If you have installed the PHPMailer via Composer, you should have a vendor folder in your project. Include /vendor/autoload.php

Michael Krutikov
  • 484
  • 1
  • 4
  • 10