raza.shahzad Posted August 13, 2006 Share Posted August 13, 2006 Hello every one,[quote]<?php// The message$message = "Line 1\nLine 2\nLine 3";// In case any of our lines are larger than 70 characters, we should use wordwrap()$message = wordwrap($message, 70);// Sendmail('[email protected]', 'My Subject', $message);?> [/quote]is there any problem in the above code? i used it to try n send email to my account from my windows PC. i have apache 1.3x, PHP 5 n mysql installed with some PHP extensions too. i don't have additional/extra knowledge of sending emails using php scripts. i can do it using smtp using tutorial in the book that i follow but i don't want to get stuck with smtp and other things. i want the send mail to be simple. few lines of codes. Link to comment https://forums.phpfreaks.com/topic/17376-can-i-not-use-mail-function-to-send-emails-to-addresses-online/ Share on other sites More sharing options...
akitchin Posted August 13, 2006 Share Posted August 13, 2006 mail() in fact uses the local SMTP server. are you getting any errors, or is it simply not sending? if it simply isn't sending, it likely means that a spam filter is blocking it.try:[code]$mail_result = mail(stuff here);echo ($mail_result === FALSE) ? 'mailing worked.' : 'mailing failed.';[/code] Link to comment https://forums.phpfreaks.com/topic/17376-can-i-not-use-mail-function-to-send-emails-to-addresses-online/#findComment-73925 Share on other sites More sharing options...
Chetan Posted August 13, 2006 Share Posted August 13, 2006 If you dont get errors and someone else hosts you, put this line in the top to see if you get errors[code=php:0]<?phpini_set('display_errors', '1');error_reporting(E_ALL);?>[/code]and then use If and else statement to check if there were problems. This is basically with your SMTP Link to comment https://forums.phpfreaks.com/topic/17376-can-i-not-use-mail-function-to-send-emails-to-addresses-online/#findComment-73942 Share on other sites More sharing options...
redarrow Posted August 13, 2006 Share Posted August 13, 2006 the correct way you use \n in the wordwrap ok.I told you before to look into wordwrap and to use it correctly instead of using copy and past.Tested and working.[code]<?php$to="[email protected]";$subject="hi there it's me";$message="hi there i am redaarow and i like php";$message=wordwrap($message,8,"\n",1);if(!$sendmail=mail($to,$subject,$message)){echo " sorry message not sent";}else{echo "message sent thank you";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/17376-can-i-not-use-mail-function-to-send-emails-to-addresses-online/#findComment-73947 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.