3

Can i set sendmail_path using ini_set in php page, without changing in php.ini file ? Like this :

 ini_set("SMTP","smtp.gmail.com");
 ini_set("smtp_port","587");

My application will run on a shared server, and we can't change server's configurations file. This is my first question here , so apologizes for any mistakes.

Divya MV
  • 2,021
  • 3
  • 31
  • 55
user3395190
  • 39
  • 1
  • 2
  • 2
    hello and welcome to so :D you can modify it by ini_set() but keep in mind ... SMTP and smtp_port flag will only work for WINDOWS-SERVER ... and have no value for UNIX/LINUX Servers as you can read here http://php.net/manual/en/mail.configuration.php#ini.smtp-port – donald123 Jul 17 '15 at 09:24

1 Answers1

2

According to the manual you can only set this parameter from php.ini or httpd.conf. i.e. changable from = PHP_INI_SYSTEM

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
  • I successfully send mail using , PHPMailer without do changes in php.ini file or httpd.conf file. But now i have a different problem. From address is being unchanged and always take the from address, which is used by me for gmail authentication. Now what should i do for chagne in from address ?? – user3395190 Jul 17 '15 at 12:37
  • I am afraid you will have to ask that as a new question. Make sure you add your code so we can see what you are doing with phpMailer – RiggsFolly Jul 17 '15 at 12:42
  • 1
    More info on `PHP_INI_SYSTEM`: http://php.net/manual/en/configuration.changes.modes.php – rinogo Aug 31 '18 at 21:38