mendoz Posted December 19, 2006 Share Posted December 19, 2006 Hey.I'm searching for hours now but can't get this right.The mail() function doesn't work and I'm having trouble with finding an alternative.I have:Mail relay onOutgoing SMTP serverPlease help before I die :-\Dror Quote Link to comment https://forums.phpfreaks.com/topic/31216-solved-using-smtp-to-send-an-email/ Share on other sites More sharing options...
HuggieBear Posted December 19, 2006 Share Posted December 19, 2006 Why doesn't the [color=green]mail()[/color] function work? Do you know?RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/31216-solved-using-smtp-to-send-an-email/#findComment-144362 Share on other sites More sharing options...
mendoz Posted December 19, 2006 Author Share Posted December 19, 2006 The hosting support guy told me it's because they host on Windows.Any alternatives? I can't seem to get the phpmailer() to work. Quote Link to comment https://forums.phpfreaks.com/topic/31216-solved-using-smtp-to-send-an-email/#findComment-144363 Share on other sites More sharing options...
HuggieBear Posted December 19, 2006 Share Posted December 19, 2006 OK, have you tried changing the SMTP setting?Huggie Quote Link to comment https://forums.phpfreaks.com/topic/31216-solved-using-smtp-to-send-an-email/#findComment-144365 Share on other sites More sharing options...
mendoz Posted December 19, 2006 Author Share Posted December 19, 2006 I don't think that's the problem.I want to send the mail through SMTP,How do I set that connection in PHP? Quote Link to comment https://forums.phpfreaks.com/topic/31216-solved-using-smtp-to-send-an-email/#findComment-144368 Share on other sites More sharing options...
HuggieBear Posted December 19, 2006 Share Posted December 19, 2006 Change the email address and the server name, upload it to the server, and then try loading it in a browser. This is as simple as it gets, so don't try changing anything else just yet, lets see if we can at least get it sending.[code]<?php// This MUST be set to your mailserver (replace 'localhost')ini_set('SMTP', 'localhost');// Who's the mail to$to_email = "email@address.co.uk";// Test Subject$subject = "Test Email";// Test Body$body = "This is our test message.\n";// DO NOT ALTER$headers = "Content-type: text/plain";if (mail($to_email, $subject, $body, $headers)){ echo "Success\n";}else { echo "Failed\n";}?>[/code]Huggie Quote Link to comment https://forums.phpfreaks.com/topic/31216-solved-using-smtp-to-send-an-email/#findComment-144370 Share on other sites More sharing options...
mendoz Posted December 19, 2006 Author Share Posted December 19, 2006 wow huggy you should have seen the faces of the people here at the shop when I released the biggest screem ever, you probably heard it too .now to add a script that verifies and we're done!Your'e the greatest!Dror Quote Link to comment https://forums.phpfreaks.com/topic/31216-solved-using-smtp-to-send-an-email/#findComment-144379 Share on other sites More sharing options...
HuggieBear Posted December 19, 2006 Share Posted December 19, 2006 Your welcome. The [url=http://uk.php.net/manual/en/function.mail.php]mail()[/url] function on Windows acts very differently to that on *nix flavour boxes.I got the information that I needed from the [url=http://uk.php.net/manual/en/ref.mail.php]Mail reference page[/url] in the [url=http://uk.php.net/manual/en/index.php]PHP Manual[/url] though.Don't forget to use the new 'Solved' button on this topic.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/31216-solved-using-smtp-to-send-an-email/#findComment-144380 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.