Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: mail() function doesn't send email; mistakes in the code Date: Fri, 5 Aug 2016 23:02:04 +0200 Lines: 29 Message-ID: References: <0d3735d9-7ed7-46f6-81e2-98ec7d5e85e0@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net 1A5C5PN/aGERH0NQ1qcXfAoq02SKTAw5S18F4WqOXP/rq4OZDI Cancel-Lock: sha1:fjdZIJ9eAkurw+wnI3ymC1tJ2wQ= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: Xref: csiph.com comp.lang.php:16921 On 08/05/16 16:26, Jerry Stuckle wrote: > On 8/5/2016 1:03 AM, J.O. Aho wrote: >> On 08/04/16 08:56, Alla wrote: >>> Hello! >>> >>> Please, take a look at the code below. I will be grateful for your help on why the code doesn't >>> work - I have tested it, but the email doesn't arrive. All other parts of the code are correct, >>> because these have been tested many times in other related files, i.e. those are templates. >>> >>> if(mail($email, $email_subject, $email_body)) >>> { >>> // render form >>> render("email_link_form.php", ["email" => $email]); >>> } >> >> The only time mail() will give you a false is when it fails to connect >> to the SMTP service configured in the php.ini. >> > > I forgot to add - that is true - but if PHP does connect to the MTA, > then there will be information in the MTA's log showing what happened. Yes, but only if you have access to the logs will you be able to figure out if it's the sending or receiving MTA which has blocked the mail and for most shared hostings you don't have access to mail logs. -- //Aho