Jump to content

PHP + Sending emails...Very new and wondering how its done.


Recommended Posts

http://www.w3schools.com/PHP/php_mail.asp

 

view that for a guide on how the php mail function works. its actually very easy. as long as you understand post variables, you can make what you want fairly easily

This is what i get:

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\emailTest.php on line 7

Mail Sent.

 

But it didnt send because i sent it to my gmail and nothing happened.

This is what i get:

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\emailTest.php on line 7

Mail Sent.

 

But it didnt send because i sent it to my gmail and nothing happened.

 

For a local wamp server chances are the mail function will not work. Due to the simple fact that you have to have a mail server installed on your box for it to work. Not to mention that most ISP's block Port 25, which is what most mail is sent on.

 

Do a google for a script called "phpGMailer" this script will allow you to input your gmail account information and send email using that as the median. See the script description etc for usage.

That is to send with GMAIL accounts only, im looking for any time of email addresses.

 

For localhost, unless you plan on setting up a full on webserver locally, that should suffice for development. Most servers provide you access to their mail server so this would not arise on an actual server.

 

I would suggest, for ease of use on a local "Development" box, if that is what it is, to use that script with a gmail account (as you can send up to 100 emails a day) and test your settings. If you do not, you can attempt to see if your ISP offers you access to an SMTP server and get that information then add it to the php.ini. If they do that would be the best route to go, or find your own free smtp service.

 

Windows boxes do not come with a mail server installed, and on linux you have to install one yourself. But access to port 25 is required for most web servers. As stated before, ISP's tend to block this port due to spam.

 

And as for that only sending to your "gmail" account, that would use your gmail account as the SMTP server. (as mike pointed out above).

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.