Jump to content

Archived

This topic is now archived and is closed to further replies.

AndyMatts

How to specify SMTP server/host in script, not .ini

Recommended Posts

Greetings, I have a script that sends out an confirmation email. I've been having a problem with "relaying" errors, and was going to go and send user and password authentication to get around this.

Tech support at my hosting service tells me that if I just specify the specific IP address as the SMTP server, I won't have to authenticate.

I don't want to change the php.ini file, however, because I think that would open up our site to use by spammers.

So... I want to write the line that specifies the smtp server when the script runs.

What is the exact syntax for that? I haven't been able to find it in any examples or in the tutorials.

I tried inserting

SMTP='ip#.ip#.ip#.ip#';

near the beginning but that crashes the script.

is it something like $_SMTP or some other structure to that?

Share this post


Link to post
Share on other sites
[!--quoteo(post=351024:date=Mar 2 2006, 11:21 AM:name=kanikilu)--][div class=\'quotetop\']QUOTE(kanikilu @ Mar 2 2006, 11:21 AM) [snapback]351024[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Have you tried [code]ini_set('SMTP', 'ipaddress');[/code] ?
[/quote]

Nope, not yet. That may be the ticket I'm looking for.

Now, does that just pass the value for use with this email, or does that alter the actual "php.ini" file?

If my concern is someone using my program as a spam hub, would I be advised to change it back to

[code]ini_set('SMTP','localhost');[/code]

when I'm done?

Share this post


Link to post
Share on other sites
In any case, I did try it with re-setting the value, and it works great.

Thanks very much for your help, that was exactly what I was looking for.

Share this post


Link to post
Share on other sites
BTW, it should only set it for that page and not change anything in the php.ini file.

Share this post


Link to post
Share on other sites
[!--quoteo(post=351115:date=Mar 2 2006, 03:26 PM:name=kanikilu)--][div class=\'quotetop\']QUOTE(kanikilu @ Mar 2 2006, 03:26 PM) [snapback]351115[/snapback][/div][div class=\'quotemain\'][!--quotec--]
BTW, it should only set it for that page and not change anything in the php.ini file.
[/quote]

That's good to know. Thanks very much for your help.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.