Jump to content

SMTP mail without php.ini


ryy705

Recommended Posts

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.

Link to comment
Share on other sites

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","fromYou@yourdomain.com.com");

Link to comment
Share on other sites

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?

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.