note 46527 added to function.mail

From: Date: Thu, 14 Oct 2004 08:45:01 +0000
Subject: note 46527 added to function.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-78529@lists.php.net to get a copy of this message
I was unable to send an e-mail with the mail() function because i set 'sendmail_path' in the php.ini to "usr/bin/sendmail -t -i". The directory existed, I'm running my own Apache-Server. Leaving it unset worked surprisingly, I got stuck with this for about 2 hours, so maybe someone has a similar problem... Here is the code that worked for me: <?php ini_set("SMTP", "mail.gmx.net"); ini_set("sendmail_from", "gigi33@gmx.at"); mail("gigi33@gmx.at","My subject","My test-body"); // I mailed to myself for testing purposes ?> Here some other code that helped me out: <?php // Get php.ini Settings $smtp = ini_get('SMTP'); $sendmail_from = ini_get('sendmail_from'); $sendmail_path = ini_get('sendmail_path'); $smtp_port = ini_get('smtp_port'); // Receiver-Adress $to = "gigi33@gmx.at"; /* Write php.ini Settings in your E-mail so if it works you can check with which configuration it worked */ $subject = "Testmail"; $body = (" Begin of testmail To: $to \n bodytext...blabla \r SMTP: $smtp \r sendmail_from: $sendmail_from \r sendmail_path: $sendmail_path \r smtp_port: $smtp_port \n End of testmail "); $mymail = mail($to,$subject,$body); // Displays true (mail delivered) or false (not) var_dump($mymail); ?> ---- Manual Page -- http://www.php.net/manual/en/function.mail.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46527 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46527&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46527&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46527&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46527&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46527&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46527&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+46527&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#78529) next »