PHPmailer allegato

Vale992

Nuovo Utente
21 Set 2015
29
3
3
Salve,
devo inviare un allegato per email con un form in html

<div class="form-group">
<label>Allegato</label>
<input type="file" name="allegato">
</div>

In php come lo implemento per scaricare l'allegato una volta che arriva l'email?


<?php
session_start();

require_once 'smarty/libs/Smarty.class.php';
require_once 'setup/config.php';

$smarty = new Smarty;
$smarty->setCompileDir('smarty/application/templates_c');
$smarty->setCacheDir('smarty/application/cache');

$to = "[email protected]";

$body .= "Messaggio: " . trim(stripslashes($_POST["messaggio"])) . "\n";
$body .= "Numero di Telefono: " . trim(stripslashes($_POST["tele"])) . "\n";

$body .= "Allegato: " . trim(stripslashes($_POST["allegato"])) . "\n";


$subject .= "Oggetto: " . trim(stripslashes($_POST["oggetto"])) . "\n";

$headers = "From: " . trim(stripslashes($_POST["email"])) . "\n";


// INVIO DELLA MAIL
if(@mail($to, $subject, $body, $headers) == true) { // SE L'INOLTRO È ANDATO A BUON FINE...

$smarty->assign('insertError', 'Email inviata');
} else {// ALTRIMENTI...

$smarty->assign('insertError', 'Email non inviata');

}


$smarty->display('smarty/application/templates/main_content/index.tpl');
 
Discussioni simili
Autore Titolo Forum Risposte Data
N PhpMailer e salvataggio allegato sul server PHP 11
metalgemini PHPmailer non arriva allegato PHP 10
piccino PHPMailer: inserire allegato PHP 5
R PhpMailer inserire Allegato PHP 1
L PhpMailer - Scrivere su file e spedire come allegato PHP 1
G phpmailer e php 8.1 con estensione mysqli PHP 6
E Hosting e phpmailer PHP 0
E PHPMailer PHP 4
D PHPMailer con account gmail PHP 14
I PHPMailer non funziona PHP 13
I Guida/Tutorial configurare PHPMailer per inviare mails tramite contact form? PHP 2
A PHPMAILER e UMLAUTS (lettere tedesche äüäöß) PHP 2
G PHPMailer: SMTP error Gmail PHP 8
M Come usare la nuova versione di phpmailer? PHP 2
P [PHPmailer] SMTP Aruba.. problemi PHP 8
G Invio Mail con PHPMailer, problemi SMTP PHP 7
V PHPMailer PHP 11
P problemi invio email con phpmailer PHP 47
P phpmailer PHP 0
localhost.nicola File log erroe con phpmailer PHP 3
A problema phpmailer PHP 32
L invio smtp con phpmailer - problema invia due volte la email allo stesso utente PHP 0
O PhpMailer, Composer e Netbeans PHP 1
M Come inviare due mail diverse con phpmailer PHP 6
Z email phpmailer non arrivano PHP 0
B Invio email multiple PHPMAILER PHP 3
L Problema phpmailer,jquery e smtp PHP 1
P Problemi visualizzazione html con phpmailer PHP 6
P phpmailer e file_get_contents PHP 1
P Phpmailer ed wind-infostrada PHP 20
felino PHPMailer: Indirizzo IP e Immagine PHP 6
lsnight Phpmailer per principianti PHP 7
K form con phpmailer PHP 18
P Invio multiplo mail con phpmailer PHP 5
L problema classe phpmailer con la mia classe clsMail PHP 2
G problema con phpmailer 5.2.1 PHP 1
minatore Phpmailer PHP 6
M phpmailer multiplo in più pagine di un sito PHP 5
N PhpMailer SELECT e OPTION PHP 190
R Phpmailer SMTP PHP 23
A problema con phpmailer PHP 10
E Invio email (era: phpmailer) PHP 52
F Phpmailer e l'indirizzo del mittente PHP 3
F PhpMailer PHP 5
borgo italia phpmailer?? PHP 7
C phpmailer PHP 7
emanuelevt phpmailer e altervista PHP 3
catellostefano Problema con la classe class.phpmailer.php PHP 5
SolidSnake4 PHPmailer errore PHP 4
A classe PHPMailer e mail di Libero PHP 1

Discussioni simili