0

my send mail is not working i have made changes in php.ini, sendmail.ini.

following code is of sendmail.ini

[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
;smtp_ssl=auto
error_logfile=error.log
;debug_logfile=debug.log
auth_username=abc@gmail.com
auth_password=password
pop3_server=
pop3_username=
pop3_password=
force_sender=abc@gmail.com
force_recipient=
hostname=

below code is for sending a test email `

<html>
<head>
<title>Send Mail</title>
</head>
<body>
    <?php
        $to = "xyz@gmail.com";
        $subject = "My Subeject";
        $txt = "Hello World!";
        $headers ="From: abc@gmail.com" . "\r\n" .
        "CC: def@gmail.com";

        // mail($to,$subject,$txt,$headers);


    if(mail($to, $subject, $txt, $headers))
    echo "Email sent";
else
    echo "Email sending failed";

    ?>
</body>
</html>

`

thankyou in advance.

suvojit_007
  • 1,690
  • 2
  • 17
  • 23
  • Are you able to send emails from command line using "sendmail"? – vik-y Nov 08 '18 at 17:35
  • how we do that? @vik-y – Ashutosh Kolambkar Nov 08 '18 at 17:38
  • googlemail will not accept mails from hosts that don't match their reverse dns entry. So your `From` header has to contain a public domain name that routes to the servers IP. From 'localhost' this will not work. – digijay Nov 08 '18 at 17:42
  • What changes have you made in php.ini? – suvojit_007 Nov 08 '18 at 17:44
  • 1
    Possible duplicate of [PHP mail function doesn't complete sending of e-mail](https://stackoverflow.com/questions/24644436/php-mail-function-doesnt-complete-sending-of-e-mail) – miken32 Nov 08 '18 at 17:47
  • @suvojit_007 Check this php,ini code [mail function] ; For Win32 only. ; http://php.net/smtp SMTP=smtp.gmail.com ; http://php.net/smtp-port smtp_port=587 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = abc@gmail.com ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" – Ashutosh Kolambkar Nov 08 '18 at 17:48

0 Answers0