Link to home
Start Free TrialLog in
Avatar of infodigger
infodigger

asked on

php.ini mail function: Send mail through remote server with authentication

Hi,

I am looking to use a remote smtp server for all emails from our server. On the php.ini file it has the lines:

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t -i              ;

How should I change them to use a remote smtp server with remote authenticaiton?
ASKER CERTIFIED SOLUTION
Avatar of hernst42
hernst42
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of infodigger
infodigger

ASKER

The problem is that my code uses mail_function() at hundereds of pages and without an include. Is there a way to make a change at the php.ini in order to avoid these changes?
if the mail function of php is used you are stuck to change that code everywhere to a stub function with an include which then uses the phpmailer class. IT is not possible via php.ini or any other config option.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perhaps you could write you own mail function that uses phpMailer such as mymail() that takes in essentially the same parameters as the php mail function. Then you could do a find/replace on each of you php files to replace the " mail(" with " mymail("
Now I thought of another way. Is it possible to configure the sendmail program on the server to send through authenticated remote smtp?
I just found this: http://blog.phpdoc.info/archives/20-mail-replacement-a-better-hack.html

it seems what I am looking for but if you look down at the script it doesn't use authentication. Maybe someone knows what variables I have to add to authenticate with PEARS?