php - mail() function cannot work with two email filters? -


i have function send email. working fine until added additional check input email (besides filter_var()) coming form check specific domain names , reject them accordingly.

i cannot understand why isn't working now.

i've added top of file:

ini_set('display_errors', true); error_reporting(e_all); 

it won't show me error message nor send email.

the part fills parameter ($correo) hasn't changed:

<?php function enviarmails($correo) {     $mimensaje = "bláh, bláh";     if (!filter_var($_post['emailremitente'], filter_validate_email)) {         echo "<br>oops! email incorrecto";     } else {             $rejecteddomains = array('midominio.org', 'midominio.com');             $emailparts = explode('@',$_post['emailremitente']);             if (in_array(strtolower($emailparts[1]), $rejecteddomains)) {                 echo "<br>oops! email incorrecto";             } else{                          $emailremitente = $_post['emailremitente'];                     $nombreremitente = $_post['nombreremitente'];                     $para   = $correo;                     $asunto = 'atencion';                     $mensaje = $mimensaje;                     $headers = 'from: '.$nombreremitente.' '.'<'.$emailremitente.'>'."\r\n";                     $headers .= 'mime-version: 1.0' . "\r\n";                     $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n";                      //mando mail los usuarios                     $enviousuarios = mail($para, $asunto, $mensaje, $headers);                         if($enviousuarios) {                              echo '<br><span class="ok">mensaje enviado '.$correo.'</span><br>';                          } else {                         echo'<br><span class="error">no se mandó mail '.$correo.'</span><br>'; }                 }     } } 

the operative part here filters lines:

... first filter: if (!filter_var($_post['emailremitente'], filter_validate_email)) {         echo "<br>oops! email incorrecto";     } else {             $rejecteddomains = array('midominio.org', 'midominio.com'); second filter:             $emailparts = explode('@',$_post['emailremitente']);             if (in_array(strtolower($emailparts[1]), $rejecteddomains)) {                 echo "<br>oops! email incorrecto";             } else{      ... 

note: english isn't native language, couldn't come better title post. if title isn't descriptive enough, please, feel free make better , clearer.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -