• Home
  • Forum
  • Fare Web
  • PHP

come mettere allegati in un mms

  • Creatore Discussione Creatore Discussione Supergatto
  • Data di inizio Data di inizio 13 Mar 2008
S

Supergatto

Nuovo Utente
14 Gen 2008
11
0
0
  • 13 Mar 2008
  • #1
Non so come mettere gli allegati in uno script php per inviare mms ho messo il destinatario il testo il mittente e funzionano, mi dite cosa devo fare per mettere gli allegati nel php :crying:
 
Ultima modifica: 13 Mar 2008

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
  • 13 Mar 2008
  • #2
Dai uno sguardo a questo tutorial
 
S

Supergatto

Nuovo Utente
14 Gen 2008
11
0
0
  • 13 Mar 2008
  • #3
Ti sembrera una domanda stupida ma mi dici quali codici devo scrivere solo per l'allegato perchè non mi funziona

codice php:
<?php
if (isset($_POST["submit"])){
$a = $_POST['a'];
$da = $_POST['da'];
$obj = $_POST['obj'];
$testo = $_POST['testo'];

$attachment = $_FILES['attachment']['tmp_name'];
$attachment_type = $_FILES['attachment']['type'];
$attachment_name = $_FILES['attachment']['name'];

$intestazioni = "From: " . $da;
$messaggio = "";

if (is_uploaded_file($attachment))
{
$file = fopen($attachment,'rb');
$data = fread($file, filesize($attachment));
fclose($file);
$data = chunk_split(base64_encode($data));
$rand = md5(time());
$boundary = "==Multipart_Boundary_x{$rand}x";

$intestazioni .= "\nMIME-Version: 1.0\n";
$intestazioni .= "Content-Type: multipart/mixed;\n";
$intestazioni .= " boundary=\"{$boundary}\"";

$messaggio .= "This is a multi-part message in MIME format.\n\n";
$messaggio .= "--{$boundary}\n";
$messaggio .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$messaggio .= "Content-Transfer-Encoding: 7bit\n\n";
$messaggio .= $testo . "\n\n";
$messaggio .= "--{$boundary}\n";
$messaggio .= "Content-Disposition: attachment;\n";
$messaggio .= " filename=\"{$attachment_name}\"\n";
$messaggio .= "Content-Transfer-Encoding: base64\n\n";
$messaggio .= $data . "\n\n";
$messaggio .= "--{$boundary}--\n";
}
else{
$messaggio = $testo;
}

if (mail($a, $obj, $messaggio, $intestazioni))
{
echo "Messaggio inviato con successo.";
}else{
echo "Si &egrave; verificato un errore nell'invio.";
}
}else{
?>

<form action="<? echo $_SERVER['PHP_SELF']; ?>"
method="POST" enctype="multipart/form-data">
Destinatario:
<input type="text" name="a"><br>
Mittente:
<input type="text" name="da"><br>
Oggetto:
<input type="text" name="obj" style="height: 22px"><br>
Messaggio:
<textarea name="testo"></textarea><br>
Allega file:
<input type="file" name="attachment"><br>
<input type="submit" name="submit" value="Invia" />
</form><?
}
?>

di tutto questo codice cosa devo scrivere?
 
Ultima modifica: 24 Mar 2008
Devi accedere o registrarti per poter rispondere.

Discussioni simili

K
Mettere insieme due funzioni
  • kerkut
  • 20 Dic 2022
  • Javascript
Risposte
2
Visite
2K
Javascript 21 Dic 2022
kerkut
K
Mettere categorie nelle anteprime degli articoli
  • Shyson
  • 27 Apr 2022
  • PHP
Risposte
1
Visite
951
PHP 18 Ago 2022
Shyson
R
Mettere in sicurezza una comunicazione
  • race
  • 16 Feb 2021
  • .NET Framework
Risposte
0
Visite
2K
.NET Framework 16 Feb 2021
race
R
G
Mettere il footer in basso
  • g3direct
  • 26 Apr 2020
  • HTML e CSS
Risposte
0
Visite
2K
HTML e CSS 26 Apr 2020
g3direct
G
G
mettere account posta in Microsoft outlook 2016 di gmail
  • Giovannino60
  • 10 Apr 2020
  • Posta Elettronica
Risposte
0
Visite
3K
Posta Elettronica 10 Apr 2020
Giovannino60
G
B
Mettere sito offline senza troppe penalizzazioni
  • btrix
  • 30 Set 2019
  • SEO e Posizionamento
Risposte
0
Visite
1K
SEO e Posizionamento 30 Set 2019
btrix
B
G
[HTML] mettere link in facebook link invece che su sito web
  • giuseppee
  • 21 Ott 2018
  • Social Media Marketing
Risposte
1
Visite
2K
Social Media Marketing 3 Dic 2018
sfranchi
S
G
[Guida MyBB 1.8] Mettere in colonna SubForum
  • Giorgio1204
  • 18 Gen 2018
  • CMS (Content Management System)
Risposte
0
Visite
4K
CMS (Content Management System) 18 Gen 2018
Giorgio1204
G
G
[Photoshop] Mettere una scritta in prospettiva.
  • Giovannino60
  • 19 Dic 2017
  • Photoshop
Risposte
7
Visite
6K
Photoshop 27 Dic 2017
filomeni
[PHP] Mettere parentesi graffe o no?
  • Shyson
  • 14 Nov 2017
  • PHP
Risposte
2
Visite
2K
PHP 15 Nov 2017
Shyson
[PHP] Mettere placeholder
  • Shyson
  • 30 Ott 2017
  • PHP
Risposte
2
Visite
3K
PHP 31 Ott 2017
Shyson
[HTML] Mettere select responsive
  • Shyson
  • 14 Set 2017
  • HTML e CSS
Risposte
3
Visite
2K
HTML e CSS 1 Ott 2017
Shyson
[HTML] Mettere div al posto di iframe e possibile?
  • giannit
  • 31 Mar 2017
  • HTML e CSS
Risposte
9
Visite
5K
HTML e CSS 2 Apr 2017
giannit
D
cambio il dominio per mettere keyword dentro?
  • diventayoutuber
  • 27 Mar 2017
  • SEO e Posizionamento
Risposte
8
Visite
2K
SEO e Posizionamento 28 Apr 2017
xone
G
[HTML] mettere menu style smartphone anche sui tablet
  • Gio Fra
  • 11 Mar 2017
  • HTML e CSS
Risposte
0
Visite
1K
HTML e CSS 11 Mar 2017
Gio Fra
G
[PHP] Mettere il link "Leggi tutto"
  • Shyson
  • 25 Feb 2017
  • PHP
Risposte
0
Visite
1K
PHP 25 Feb 2017
Shyson
L
mettere un simbolo per capire se è un sottomenu
  • luigi777
  • 8 Feb 2017
  • jQuery
Risposte
2
Visite
2K
jQuery 8 Feb 2017
luigi777
L
[WordPress] Mettere un limite a lunghezza caratteri
  • Shyson
  • 5 Nov 2016
  • WordPress
Risposte
11
Visite
2K
WordPress 5 Nov 2016
Shyson
[WordPress] Mettere classe css
  • Shyson
  • 27 Ott 2016
  • WordPress
Risposte
0
Visite
2K
WordPress 27 Ott 2016
Shyson
Mettere span davanti a php
  • Shyson
  • 12 Ott 2016
  • PHP
Risposte
9
Visite
2K
PHP 13 Ott 2016
Shyson
Condividi:
Facebook X (Twitter) LinkedIn WhatsApp e-mail Condividi Link
  • Home
  • Forum
  • Fare Web
  • PHP
  • Italiano
  • Termini e condizioni d'uso del sito
  • Policy Privacy
  • Aiuto
  • Home
Community platform by XenForo® © 2010-2024 XenForo Ltd. | Traduzione a cura di XenForo Italia
Menu
Accedi

Registrati

  • Home
  • Forum
    • Nuovi Messaggi
    • Cerca...
  • Novità
    • Featured content
    • Nuovi Messaggi
    • Ultime Attività
X

Privacy & Transparency

We use cookies and similar technologies for the following purposes:

  • Personalized ads and content
  • Content measurement and audience insights

Do you accept cookies and these technologies?

X

Privacy & Transparency

We use cookies and similar technologies for the following purposes:

  • Personalized ads and content
  • Content measurement and audience insights

Do you accept cookies and these technologies?