5 Replies - 2332 Views - Last Post: 15 April 2011 - 01:08 PM Rate Topic: -----

#1 D.Mulroy  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 81
  • View blog
  • Posts: 430
  • Joined: 30-June 10

How to set up mail() with WAMP

Posted 14 April 2011 - 06:28 PM

I am trying to learn php following Head First: Php & MySQL and have made a web form that is supposed to send out an email. At this point, to my understanding, I have to manually configure my mailserver or smtp or something along the lines of that. When I run my script this is what show up:

Warning: mail() [function.mail]: SMTP server response: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html in C:\wamp\www\Chapter_1\report.php on line 2


Here is my php script

<html>
<head>
	<title>Aliens Abducted Me - Report an Abduction</title>
</head>
<body>
	<h2>Aliens Abducted Me - Report an Abduction</h2>
<?php
	$name = $_POST['firstname'] . ' ' . $_POST['lastname'];
	$how_many = $_POST['howmany'];
	$when_it_happened = $_POST['whenithappened'];
	$how_long = $_POST['howlong'];
	$alien_description = $_POST['aliendescription'];
	$what_they_did = $_POST['whattheydid'];
	$fang_spotted = $_POST['fangspotted'];
	$email = $_POST['email'];
	$other = $_POST['other'];
	$to = 'mulroyphp@yahoo.com';
	$subject = 'Aliens Abducted Me - Abduction Report';
	
	$msg = "$name was abducted $when_it_happened and was gone for $how_long. \n" .
		"Number of aliens: $how_many \n" .
		"Alien description: $alien_description\n" .
		"What they did: $what_they_did\n" .
		"Fang spotted: $fang_spotted\n" .
		"Other comments: $other";
	mail($to, $subject, $msg, 'From: ' . $email);
		
	echo $name . ', thanks for submitting the form. <br />';
	echo 'You were abducted ' . $when_it_happened;
	echo ' and were gone for ' . $how_long . '<br />';
	echo 'Number of aliens: ' . $how_many . '<br />';
	echo 'Describe them: ' . $alien_description . '<br />';
	echo 'The aliens did this: ' . $what_they_did . '<br />';
	echo 'Was Fang there? ' . $fang_spotted . '<br />';
	echo 'Other comments: ' . $other . '<br />';
	echo 'Your email address is: ' . $email;
	
?>
</body>
</html>



Here is my php.ini (From what I got off google I need to change this around?)

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = youremail@yourdomain



If this needs to be moved Web Servers please do so :]

Regards,

D.Mulroy

This post has been edited by D.Mulroy: 15 April 2011 - 10:26 AM


Is This A Good Question/Topic? 0
  • +

Replies To: How to set up mail() with WAMP

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 3873
  • View blog
  • Posts: 11,407
  • Joined: 18-April 07

Re: How to set up mail() with WAMP

Posted 14 April 2011 - 10:05 PM

Keep in mind that if you are sending mail through Yahoo's SMTP that it is secure and needs authentication (SSL). This means you usually have to change the port (usually to something like 995) and provide a username/password to access it.

If you have your own personal email account, I would test your script with that. Those emails given to you by your ISP are typically not SSL secured and you can freely send mail through their smtp using your username and password without needing SSL enabled.

:)
Was This Post Helpful? 1
  • +
  • -

#3 D.Mulroy  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 81
  • View blog
  • Posts: 430
  • Joined: 30-June 10

Re: How to set up mail() with WAMP

Posted 15 April 2011 - 04:20 AM

How would I go about setting the php.ini to comply with my isp's SMPT? Where would I supply the username and password? My isp is Comcast in case you need to know.

Thanks for your help Martyr
Was This Post Helpful? 0
  • +
  • -

#4 D.Mulroy  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 81
  • View blog
  • Posts: 430
  • Joined: 30-June 10

Re: How to set up mail() with WAMP

Posted 15 April 2011 - 10:28 AM

So to use my isp, which is comcast I should change the SMTP = smpt.comcast.net? Where do I need to input my account name and password? and do I need to change the smtp_port number?

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.comcast.net
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = youremail@yourdomain


Was This Post Helpful? 0
  • +
  • -

#5 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 3873
  • View blog
  • Posts: 11,407
  • Joined: 18-April 07

Re: How to set up mail() with WAMP

Posted 15 April 2011 - 01:02 PM

Yes you would need smtp.comcast.net and be sure you put in your email in the sendmail_from portion there on your php.ini. You may not need the username/pass since it is through your ISP. I would go ahead and set the smtp server name, leave the port 25 and put in your email address as the sendmail_from value and then restart apache so that your PHP.ini settings get reloaded.

Then give mail() a try again. :)
Was This Post Helpful? 1
  • +
  • -

#6 D.Mulroy  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 81
  • View blog
  • Posts: 430
  • Joined: 30-June 10

Re: How to set up mail() with WAMP

Posted 15 April 2011 - 01:08 PM

edit v.2

switched the port to 25 and it now works!

Thanks a ton!

the mail was sent to my spam folder though, anyway to prevent that?


switched send_mailfrom to an actual email.

p.s. i'd up rep up but ran out for the day thanks to sloths thread hah

This post has been edited by D.Mulroy: 15 April 2011 - 02:00 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1