ryy705 Posted April 23, 2008 Share Posted April 23, 2008 Hello, Is there a way to send smtp mail without messing with the php.ini file? A lot of web hosts don't seem to allow access to it. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/102592-smtp-mail-without-phpini/ Share on other sites More sharing options...
iarp Posted April 23, 2008 Share Posted April 23, 2008 From my understanding you can make your own php.ini file and upload it to the root folder where the script for sending the e-mail is located. Quote Link to comment https://forums.phpfreaks.com/topic/102592-smtp-mail-without-phpini/#findComment-525393 Share on other sites More sharing options...
PFMaBiSmAd Posted April 23, 2008 Share Posted April 23, 2008 When php is installed as an Apache module, you can put php settings in a .htaccess file (if the web host has allowed it.) When php is installed as a CGI wrapper, you can put php setting in a local php.ini file (if the web host has allowed it.) If neither of the above are available to you, the SMTP and smtp_port settings can be changed in your script using ini_set() statements. To send email (to anyone but yourself) you need a public mail server. If you are sending through a mail server that is not local to your web host, you will need to use SMTP authentication to get it to accept emails for forwarding. The php mail() function does not support SMTP authentication, so messing with php.ini and the mail settings would have no effect anyway. Describe more fully what you are trying to accomplish and someone can probably help. Quote Link to comment https://forums.phpfreaks.com/topic/102592-smtp-mail-without-phpini/#findComment-525413 Share on other sites More sharing options...
ryy705 Posted April 24, 2008 Author Share Posted April 24, 2008 Thank you for your responses. I want to create websites which are completely portable. I do not want to use the mail() function because a lot servers do not except mails unless they are from a real email account. I don't want to mess with php.ini files because some servers don't allow that either. I guess I shouldn't use any method that has the 'if the server allows it' condition attached to it. I just googled 'ini_set() smtp' but it still isn't clear to me. I found the following example on another forum. I don't see entries for username and password for the email account. Also, is port 25 a universal port for these sort of things? Thanks in advance. ini_set("smtp","mail.yourdomain.com"); ini_set("smtp_port","25"); ini_set("sendmail_from","[email protected]"); Quote Link to comment https://forums.phpfreaks.com/topic/102592-smtp-mail-without-phpini/#findComment-526053 Share on other sites More sharing options...
The Little Guy Posted April 24, 2008 Share Posted April 24, 2008 give it a try, and see if it works Quote Link to comment https://forums.phpfreaks.com/topic/102592-smtp-mail-without-phpini/#findComment-526058 Share on other sites More sharing options...
ryy705 Posted April 24, 2008 Author Share Posted April 24, 2008 Nope, doesn't work. Quote Link to comment https://forums.phpfreaks.com/topic/102592-smtp-mail-without-phpini/#findComment-526092 Share on other sites More sharing options...
The Little Guy Posted April 24, 2008 Share Posted April 24, 2008 Are you saying your host doesn't allow you to send mail? are you on a free server? Quote Link to comment https://forums.phpfreaks.com/topic/102592-smtp-mail-without-phpini/#findComment-526097 Share on other sites More sharing options...
ryy705 Posted April 24, 2008 Author Share Posted April 24, 2008 Oh, I see what you are saying. Right now I am trying to login to my gmail account from my lamp notebook. I will try it from the real web server. Quote Link to comment https://forums.phpfreaks.com/topic/102592-smtp-mail-without-phpini/#findComment-526122 Share on other sites More sharing options...
ryy705 Posted April 24, 2008 Author Share Posted April 24, 2008 Failed again. Php code says that mail has been sent but I don't receive anything(its been hours). I don't think I can send mail this way from this particular server. Is there a way to send email from my own account using php? Can I log into a gmail account and send mails with php scripts? Quote Link to comment https://forums.phpfreaks.com/topic/102592-smtp-mail-without-phpini/#findComment-526394 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.