Jump to content

ricferr

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ricferr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I forgot to add that the file is being properly uploaded but the sending of the mail fails. thanks RF
  2. Hi, I'm having a similar problem with another script. It's a form to which should allow to send an attachment. The file is being uploaded but the mail is not sent. I implemented your correction in this script but I'm missing something. Anyone has any suggestions? thanks Regards RF <?php function mail_attach($para, $de, $assunto, $mensagem, $ficheiro) { $mime_boundary = "<<<:" . md5(uniqid(mt_rand(), 1)); $data = chunk_split(base64_encode(implode("", file($ficheiro)))); $header = "From: ".$de."\r\n"; $header.= "To: ".$para."\r\n"; $header.= "MIME-Version: 1.0\r\n"; $header.= "Content-Type: multipart/mixed;\r\n"; $header.= " boundary=\"".$mime_boundary."\"\r\n"; $content = "This is a multi-part message in MIME format.\r\n\r\n"; $content.= "--".$mime_boundary."\r\n"; $content.= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n"; $content.= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $content.= $mensagem."\r\n"; $content.= "--".$mime_boundary."\r\n"; $content.= "Content-Disposition: attachment;\r\n"; $content.= "Content-Type: Application/Octet-Stream; name=\"".$ficheiro."\"\r\n"; $content.= "Content-Transfer-Encoding: base64\r\n\r\n"; $content.= $data."\r\n"; $content.= "--" . $mime_boundary . "\r\n"; if(mail($para, $de, $assunto, $content, $header)) { return TRUE; } return FALSE; } if($_FILES['userfile'] != "") { //Se houver anexo $data = $_FILES['userfile']['name']; $data2 = $_FILES['userfile']['tmp_name']; copy($data2, $data) or die ("Houve um erro na cópia do ficheiro, o envio da mensagem será abortado."); //mail_attach ("destinatário", nome e e-mail do utilizador, "assunto", texto da mensagem, ficheiro anexo); $name_field = $_POST['nome']; $email_field = $_POST['email']; $mensagem = $_POST['nifrec']; $body = "DADOS DO PARTICIPANTE\r\n"; $body .= "\r\n nome: " . $_POST['nome']; $body .= "\r\n afiliação: " . $_POST['afilicao']; $body .= "\r\n departamento: " . $_POST['departamento']; $body .= "\r\n morada: " . $_POST['morada']; $body .= "\r\n código postal: " . $_POST['codpost1'] . " - " . $_POST['codpost2'] . " " . $_POST['localidade'] ; $body .= "\r\n telefone: " . $_POST['telefone'] . " - " . "fax: " . $_POST['fax'] ; $body .= "\r\n e-mail: " . $_POST['email']; $body .= "\r\n\r\n dias seleccionados: " . $_POST['allitems']; $body .= "\r\n valor total: " . $_POST['answer'] . " Euros"; $body .= "\r\n \r\n \r\n DADOS PARA EMISSÃO DE RECIBO \r\n "; $body .= "\r\n nome/ entidade: " . $_POST['nomerec']; $body .= "\r\n morada: " . $_POST['moradarec']; $body .= "\r\n código postal: " . $_POST['codpost1rec'] . " - " . $_POST['codpost2rec'] . " " . $_POST['localidaderec'] ; $body .= "\r\n NIF: " . $_POST['nifrec']; mail_attach("ricardo.ferreira@pointoview.net" . "," . $email_field, $name_field . "<" . $email_field . ">", $assunto . " (via attach script)", $body, $data) or die ("O envio dos seus dados falhou! (via attach script)"); header("location: obrigado.html"); unlink ($data); } else { //Se não houver anexo //mail ("destinatário", "assunto", texto da mensagem, nome e e-mail do utilizador); $name_field = $_POST['nome']; $email_field = $_POST['email']; $assunto = "Inscrição de: " . $_POST['nome']; $body = "DADOS DO PARTICIPANTE\r\n"; $body .= "\r\n nome: " . $_POST['nome']; $body .= "\r\n afiliação: " . $_POST['afilicao']; $body .= "\r\n departamento: " . $_POST['departamento']; $body .= "\r\n morada: " . $_POST['morada']; $body .= "\r\n código postal: " . $_POST['codpost1'] . " - " . $_POST['codpost2'] . " " . $_POST['localidade'] ; $body .= "\r\n telefone: " . $_POST['telefone'] . " - " . "fax: " . $_POST['fax'] ; $body .= "\r\n e-mail: " . $_POST['email']; $body .= "\r\n\r\n dias seleccionados: " . $_POST['allitems']; $body .= "\r\n valor total: " . $_POST['answer'] . " Euros"; $body .= "\r\n \r\n \r\n DADOS PARA EMISSÃO DE RECIBO \r\n "; $body .= "\r\n nome/ entidade: " . $_POST['nomerec']; $body .= "\r\n morada: " . $_POST['moradarec']; $body .= "\r\n código postal: " . $_POST['codpost1rec'] . " - " . $_POST['codpost2rec'] . " " . $_POST['localidaderec'] ; $body .= "\r\n NIF: " . $_POST['nifrec']; mail("ricardo.ferreira@pointoview.net" . "," . $_POST['email'], $assunto . " (via no attach script)", $body, "From:\"" . $name_field ."\"<" . $email_field . ">\n") or die ("O envio dos seus dados falhou! (via no attach script)"); header("location: obrigado.html"); } ?>
  3. Hi, I haven't tried your solution yet but you're probably right. Just wanted to thank you for the hint regards RF
  4. Hi, I have this navigation menu on 2 websites which used to work just fine. After a recent update to the php server, the menu stopped working properly. It still loads the pages but the highlighted option doesn't change. One of the websites is this one: http://www.lisbonflats.com Any suggestions? <tr class="menubar"> <td> <?php if ($menusel<=1) { ?> <font color="#ffffff">home ></font> <? } else { ?> <a href="main01.php?menusel=1" target="main">home </a> <? } ?> </td> </tr> <tr class="menubar"> <td> <? if ($menusel==2) { ?> <font color="#ffffff">local ></font> <? } else { ?> <a href="main02.php?menusel=2" target="main">local </a> <? } ?> </td> </tr> Thanks in advance regards RF
  5. Thanks everyone for the help. The form is now working fine. However, a problem persists with the photo gallery. Before this PHP update, when clicking on a thumbnail, a new window would open with the full size version of the chosen pic. Now, the window opens but the pic is not found. I don't think the same solution applies to this problem as the variable from the thumbnails page is not sent with the POST method. I'm uploading both the thumbnails file and the pics file. Thanks in advance regards RF [attachment deleted by admin]
  6. Hi all, I had this form running for a website and, apparently without any reason, it stopped working. When the submit button is pressed, it just reloads the page. I tried uploading an old version of the form, which I'm sure to be working fine when it was removed (more than a year ago) and it too doesn't work. It has been suggested that some new PHP patch may have been released and, thus, stopping my form is from running. I'm uploading the form just in case someone has any idea. thanks in advance regards Ricardo Ferreira [attachment deleted by admin]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.