Friday, 19 June 2020

php mail local host server

smtp server
open the file from sendmail
sendmail.ini
smtp_server=mail.mydomain.com smtp.gmail.com get the smtp server
change to gmail server
smtp_port=25 587 change to port 
smtp_ssl=auto tls change the ssl
auth_username= emailid write the emial id 
auth_password= password write the password
force_sender= emailid write theemial id
hostname= localhost write the host
uncomment ;error_logfile=error.log to error_logfile=error.log create the error.log file
uncomment ;debug_logfile=debug.log to debug_logfile=debug.log create the debug.log file
php.ini
xampp/php/php.ini
[mail function]
; For Win32 only. ; For Win32 only.
; http://php.net/smtp ; http://php.net/smtp
SMTP=localhost ;SMTP=localhost comment the local host
; http://php.net/smtp-port ; http://php.net/smtp-port
smtp_port=25 ;smtp_port=25 comment the port
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from =  ;sendmail_from =  coment the sendmail from
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path = sendmail_path = C:\xampp\sendmail\sendmail.exe
extension=php_openssl.dll check this enabls or not checks theis
check in errror log
debug
myaccountsignin
allowlesssecureapps
<?php  
   $to = "recievver mailid";//change receiver address  
   $subject = "hai vamsi";  
   $message = "This is simple text amessage.";  
   $header = "From:vamsikrishnaengineer@gmail.com \r\n";  
  
   $result = mail ($to,$subject,$message,$header);  
  
   if( $result == true ){  
      echo "Message sent successfully...";  
   }else{  
      echo "Sorry, unable to send mail...";  
   }  
?>  







No comments:

Post a Comment