Krisando Posted September 23, 2010 Share Posted September 23, 2010 Hey, i'm needing to use email in a php script, but i've had no luck getting this working.. Even with perfectly given details. Is there another way which would let me email? I've tried using smtp details from live, gmail, isp email... All of which say it's send, but is not the case. The function is extremely broken, is there an alternative? Or some way to get this working? Kris. Quote Link to comment Share on other sites More sharing options...
trq Posted September 23, 2010 Share Posted September 23, 2010 The mail function is NOT broken. Quote Link to comment Share on other sites More sharing options...
Krisando Posted September 23, 2010 Author Share Posted September 23, 2010 The mail function is NOT broken. Wherever I read, it's not working because of spam. Everything is blocking it from working, therefore broken? Quote Link to comment Share on other sites More sharing options...
trq Posted September 23, 2010 Share Posted September 23, 2010 The mail function is NOT broken. Wherever I read, it's not working because of spam. Everything is blocking it from working, therefore broken? Is that a question? The mail function is not broken. You may have something on your server misconfigured, but I assure you, your problem lies elsewhere. Are you sending the correct headers? Sending a from a valid email address? Are your DNS entries configured properly? Quote Link to comment Share on other sites More sharing options...
Krisando Posted September 23, 2010 Author Share Posted September 23, 2010 Are you sending the correct headers? Are headers necessary with this function? Sending a from a valid email address? Are your DNS entries configured properly? This is the entire header, with just about everything in it. $message = " $todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n "; mail("YourEmail", $subject, $message, $from); Sending a from a valid email address? Does the email account have to be on the hosing pc? Are your DNS entries configured properly? I scanned the xampp folder for string "dns", nothing like this seems to exist in apache/php. If it's dns in network settings, yes it's configured. Quote Link to comment Share on other sites More sharing options...
trq Posted September 23, 2010 Share Posted September 23, 2010 Since you mentioned xampp, is this a local dev box your using? You do relasie you need a mail server installed to be able to send email via php? Quote Link to comment Share on other sites More sharing options...
Krisando Posted September 23, 2010 Author Share Posted September 23, 2010 Oh, I see. Must be hosting a webserver to send. Mercury is abit complicated, can't get working. I've tried hmailserver also, following the documentation to the end. No luck. Is there another way? Quote Link to comment Share on other sites More sharing options...
mikosiko Posted September 23, 2010 Share Posted September 23, 2010 SwiftMailer http://www.swiftmailer.org/ read the documentation and try Quote Link to comment Share on other sites More sharing options...
ShibSta Posted September 23, 2010 Share Posted September 23, 2010 This is the entire header, with just about everything in it. $message = " $todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n "; mail("YourEmail", $subject, $message, $from); The mail function is: mail( $to, $subject, $message[, $additional_headers [, $additional_parameters ]] ); Not: mail( $to, $subject, $message, $from ); ============================================ Also, according to RFC 2822 - the format for the From address should be: $visitor <$visitormail> Not: $visitor ($visitormail) This may help you with the headers too: http://www.webmasterworld.com/forum88/13383.htm Quote Link to comment Share on other sites More sharing options...
rwwd Posted September 23, 2010 Share Posted September 23, 2010 If your using mail() on xampp (like I do, and have for eons) then, in the script you are using type this on the very top of the file:- <?php error_reporting(E_ALL): //Rest of your code //and the mail function Then when you run the script and the mail function is invoked, there should now be an error message printed to screen, stating about a failure to connect to the smtp server, this therefore confirms that the mail function has been called and is attempting to send an email. Ergo: mail() funciton - Functional. Upload to your test server, send an emial, wait 10 mins, check the spam folder & the inbox - result, email arrived. Be aware, there is no method of checking that the sending has actually worked, we just take php's word for it that the mail has been sent, the only real confirmation is the email in the inbox. Rw Quote Link to comment Share on other sites More sharing options...
fortnox007 Posted September 23, 2010 Share Posted September 23, 2010 I use xampp too and this is what did the trick for me I edited php.ini I added my ISP (the one I pay to be on the internet smtp.myisp.co.uk it can look something like this: [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = smtp.myisp.co.uk ; http://php.net/smtp-port smtp_port = 25 although i don't use smtp (as far as i know), i found it somewhere on the internet applied it and it worked. Quote Link to comment Share on other sites More sharing options...
trq Posted September 24, 2010 Share Posted September 24, 2010 I use xampp too and this is what did the trick for me I edited php.ini I added my ISP (the one I pay to be on the internet smtp.myisp.co.uk it can look something like this: [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = smtp.myisp.co.uk ; http://php.net/smtp-port smtp_port = 25 although i don't use smtp (as far as i know), i found it somewhere on the internet applied it and it worked. smtp refers to the protocol of email so you are indeed using it. Your isp also sux because they are allowing there servers to be used without any authentication being required. Quote Link to comment 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.