AndyMatts Posted March 2, 2006 Share Posted March 2, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/3918-how-to-specify-smtp-serverhost-in-script-not-ini/ Share on other sites More sharing options...
kanikilu Posted March 2, 2006 Share Posted March 2, 2006 Have you tried [code]ini_set('SMTP', 'ipaddress');[/code] ? Quote Link to comment https://forums.phpfreaks.com/topic/3918-how-to-specify-smtp-serverhost-in-script-not-ini/#findComment-13605 Share on other sites More sharing options...
AndyMatts Posted March 2, 2006 Author Share Posted March 2, 2006 [!--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? Quote Link to comment https://forums.phpfreaks.com/topic/3918-how-to-specify-smtp-serverhost-in-script-not-ini/#findComment-13676 Share on other sites More sharing options...
AndyMatts Posted March 2, 2006 Author Share Posted March 2, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/3918-how-to-specify-smtp-serverhost-in-script-not-ini/#findComment-13685 Share on other sites More sharing options...
kanikilu Posted March 2, 2006 Share Posted March 2, 2006 BTW, it should only set it for that page and not change anything in the php.ini file. Quote Link to comment https://forums.phpfreaks.com/topic/3918-how-to-specify-smtp-serverhost-in-script-not-ini/#findComment-13693 Share on other sites More sharing options...
AndyMatts Posted March 3, 2006 Author Share Posted March 3, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/3918-how-to-specify-smtp-serverhost-in-script-not-ini/#findComment-14001 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.