Jump to content

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


AndyMatts

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?
Link to comment
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?
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.