sriindira Posted October 18, 2006 Share Posted October 18, 2006 Iam a newbie to Php and after searching a lot in google i learnt abt the mail() function in PHP and decided to use it this is the sample file code iam using<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head> <title></title></head><body><?phpini_set("sendmail_from", "[email protected]");$to = "[email protected]";$subject = "This is an Email";$body = "This is the email body,";$headers = 'MIME-Version: 1.0' . "\r\n";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; //This is for HTM Format$headers .= 'To: ME<'.$_to.'>,' . "\r\n";$headers .= 'From: Name<[email protected]>' . "\r\n";if(mail($to, $subject, $body, $headers)){echo "Mail should have sent";}else{echo "There must have been an error";}?></body></html>However iam not able to get any mail . I also used this code to check if php was installed and it was installed<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head> <title></title></head><body><?phpphpinfo();?> </body></html>I saw the SMTP was pointing to Localhost so decided to change it to what i use in my OE ( though i dont know if we shld use that )i used ini_set("SMTP", "mail.domainame.net");in my initial line. Even then it doesnt send any mail. Since i use free host they dont provide me with any techical support.Could someone help me :( Link to comment https://forums.phpfreaks.com/topic/24353-help-for-a-newbie-mail-function/ Share on other sites More sharing options...
printf Posted October 18, 2006 Share Posted October 18, 2006 Do you have to use a password when using OE, if you do, then the mail() will not work as it does not support any kind of AUTH!me! Link to comment https://forums.phpfreaks.com/topic/24353-help-for-a-newbie-mail-function/#findComment-110788 Share on other sites More sharing options...
sriindira Posted October 18, 2006 Author Share Posted October 18, 2006 Hi it doesnt need any authorizationhowever i tried the same from someother hosting which i have it sends mail but sends it as [email protected] in this nameI dont knowwhy Also when i use ftp i dont see any kind of CGI or PHP folders in both my ftp folders the first host doesnt send mail though it gives mail should have sent in the echo command and the other sends mailbut in different name as [email protected]I dont know whats the mistake Link to comment https://forums.phpfreaks.com/topic/24353-help-for-a-newbie-mail-function/#findComment-110793 Share on other sites More sharing options...
sriindira Posted October 18, 2006 Author Share Posted October 18, 2006 Also i checked the server API in the phpversion() FOr the host which sends mail it is given as CGIFor the host which doesnt send mail it gives apacheSince i dont know much about PHP can you tell me how shld i send mail for an apache server basically Link to comment https://forums.phpfreaks.com/topic/24353-help-for-a-newbie-mail-function/#findComment-110796 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.