eva21 Posted April 23, 2009 Share Posted April 23, 2009 I have a form and i ask for a user's email address. How do i send an email using their address? Very new to this...I have wamp installed! If anyone could find me example codes or steps that would be great Quote Link to comment https://forums.phpfreaks.com/topic/155425-php-sending-emailsvery-new-and-wondering-how-its-done/ Share on other sites More sharing options...
mikesta707 Posted April 23, 2009 Share Posted April 23, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/155425-php-sending-emailsvery-new-and-wondering-how-its-done/#findComment-817866 Share on other sites More sharing options...
eva21 Posted April 23, 2009 Author Share Posted April 23, 2009 I see that something about SMTP, how would i install that on php.ini and how would i find that? Quote Link to comment https://forums.phpfreaks.com/topic/155425-php-sending-emailsvery-new-and-wondering-how-its-done/#findComment-817883 Share on other sites More sharing options...
mikesta707 Posted April 23, 2009 Share Posted April 23, 2009 i think it should already be installed... Just try to write a simple script and see if it works. I didn't need to install anything special on my server to use the mail function Quote Link to comment https://forums.phpfreaks.com/topic/155425-php-sending-emailsvery-new-and-wondering-how-its-done/#findComment-817886 Share on other sites More sharing options...
eva21 Posted April 23, 2009 Author Share Posted April 23, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/155425-php-sending-emailsvery-new-and-wondering-how-its-done/#findComment-817888 Share on other sites More sharing options...
premiso Posted April 23, 2009 Share Posted April 23, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/155425-php-sending-emailsvery-new-and-wondering-how-its-done/#findComment-817889 Share on other sites More sharing options...
mikesta707 Posted April 23, 2009 Share Posted April 23, 2009 Oh sorry didnt realize it was a wamp server. yeah mail probably wont work then Quote Link to comment https://forums.phpfreaks.com/topic/155425-php-sending-emailsvery-new-and-wondering-how-its-done/#findComment-817892 Share on other sites More sharing options...
eva21 Posted April 23, 2009 Author Share Posted April 23, 2009 That is to send with GMAIL accounts only, im looking for any time of email addresses. Quote Link to comment https://forums.phpfreaks.com/topic/155425-php-sending-emailsvery-new-and-wondering-how-its-done/#findComment-817895 Share on other sites More sharing options...
mikesta707 Posted April 23, 2009 Share Posted April 23, 2009 no that would use your gmail account to send whoever you want an email. it would be from your gmail account, instead of being from your server Quote Link to comment https://forums.phpfreaks.com/topic/155425-php-sending-emailsvery-new-and-wondering-how-its-done/#findComment-817896 Share on other sites More sharing options...
premiso Posted April 23, 2009 Share Posted April 23, 2009 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). Quote Link to comment https://forums.phpfreaks.com/topic/155425-php-sending-emailsvery-new-and-wondering-how-its-done/#findComment-817897 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.