phpmailer

Skills07

Head of Development
Staff Forum
Utente Èlite
35,447
11,502
CPU
Ryzen 7 5800x
Dissipatore
Deepcool gammax l240 v2
Scheda Madre
Aourus Gigabyte X-470 ultra gaming
HDD
Samsung Evo 850 250gb ,2tb x 2 toshiba P300, 256 Ssd silicon power, Samsung evo plus 1tb nvme
RAM
32 gb G.Skill Tridentz 3200 mhz RGB
GPU
Zotac - RTX 3070 Ti Trinity OC
Monitor
ASUS TUF QHD 165hz IPS, ITEK GCF 165hz IPS QHD, Samsung Curvo 144hz QHD
PSU
Seasonic Focus 650w 80 platinum
Case
Coolermaster h500p
Periferiche
Asus Tuf Wireless
Net
Fibra Tim 100mb
OS
Windows 10 Pro 64 bit
salve ragazzi

sto sviluppando un sito web php.

stamane ho fatto questo e funziona riesco a mandare la mail con un indirizzo settato in modo definitivo, però vorrei renderlo variabile:

sulla mia main page ho questo panel

HTML:
<div id="panel-email" class="modal" style="z-index:99999;">

        <div id="container" style="display:block;">
            <form action ="sendmailwebsite.php" method="POST">
            <img id="image" src="immagini/immaginiprova/background.png" />
            <p id="text">
                <img id="password_forgot" src="immagini/forgot.png" style="width:90%; margin-left:5%;"/>
                <br>
                <br>
                <br>
                <label for="email_address" style="font-family: foo; font-size:40px; margin-left: 10%;">Email:</label>
                <br>
                <br>
                <input type="text" id="email-recovery" class="textField" style="width:620px; height:42px;  margin-left: 10%; font-size:25px; font-family: 'Fontdiner Swanky', cursive;"/>
                <br>
                <br>
                <!--<img id="ok" src="immagini/ok.png"  style="width:30%;margin-top:20%; margin-left: 35%;" />-->
                <input type="image" value="send" src="immagini/ok.png" alt="Submit" style="width:30%; float:right;margin-top: 20%; margin-right:35%;"
            </p>
            </form>


come vedete richiama un sendmailwebsite.php


ed ora vi mostro quello script php

PHP:
require_once('scripts/php_scripts/mail_prova/class.phpmailer.php');
require_once('scripts/php_scripts/mail_prova/class.smtp.php');
require_once('scripts/php_scripts/mail_prova/class.pop3.php');
require_once('scripts/php_scripts/mail_prova/class.phpmaileroauthgoogle.php');
require_once('scripts/php_scripts/mail_prova/class.phpmaileroauth.php');



$address = "";



    $mail = new PHPMailer();

    $body = "<html>
            <head>
            <title>You have requested to change your password, because you have forgot it!</title>
            </head>
            <body>
            <p>To change the password you need to click this link and then go to change it!</p>
            <table>
            <tr>
           
            </tr>
            <tr>
            <td>Link of the email</td>
            <td><a href=\"#\">guesswholink</a></td>
            </tr>
            </table>
            </body>
            </html>";
//$body             = eregi_replace("[\]",'',$body);

    $mail->IsSMTP(); // telling the class to use SMTP
//$mail->Host       = "ssl://smtp.gmail.com"; // SMTP server
    $mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
    // 1 = errors and messages
    // 2 = messages only
    $mail->SMTPAuth   = true;                  // enable SMTP authentication
    $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
    $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
    $mail->Port       = 465;                   // set the SMTP port for the GMAIL server
    $mail->Username   = "lavagnacondivisa@gmail.com";  // GMAIL username
    $mail->Password   = "lavagna2016";            // GMAIL password

    $mail->SetFrom('guesswho@gmail.com', 'GuessWho the game');

//$mail->AddReplyTo("user2@gmail.com', 'First Last");

    $mail->Subject    = "Request Changing Password";

//$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

    $mail->MsgHTML($body);

    //$address = "christian.cortese.cc@gmail.com";
    $mail->AddAddress($address, "user");

//$mail->AddAttachment("images/phpmailer.gif");      // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment

    if(!$mail->Send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
        echo "Message sent!";
    }

vorrei valorizzare address con il campo di input impostato nel pannello sopra come faccio??
 

elvan2

Utente Èlite
6,520
1,990
CPU
Intel i5 4590
Dissipatore
CM Hyper T4
Scheda Madre
H97 PLUS Asus
HDD
vari
RAM
HyperX (2X4GB) DDR3 1600MHz
GPU
Sapphire TOXIC R9 270X 2GB
PSU
Antec Neo Eco 520c
Case
Zalman z3
Sostituisci questa riga :
HTML:
 <input type="text" id="email-recovery" class="textField" style="width:620px; height:42px;  margin-left: 10%; font-size:25px; font-family: 'Fontdiner Swanky', cursive;"/>
con :
HTML:
 <input type="text" name="email" id="email-recovery" class="textField" style="width:620px; height:42px;  margin-left: 10%; font-size:25px; font-family: 'Fontdiner Swanky', cursive;"/>
e poi alla variabile $address ottieni il testo di email ( che ho aggiunto io) con $_POST
PHP:
$address = $_POST['email'];

fammi sapere se funziona dai
 
Ultima modifica:

Skills07

Head of Development
Staff Forum
Utente Èlite
35,447
11,502
CPU
Ryzen 7 5800x
Dissipatore
Deepcool gammax l240 v2
Scheda Madre
Aourus Gigabyte X-470 ultra gaming
HDD
Samsung Evo 850 250gb ,2tb x 2 toshiba P300, 256 Ssd silicon power, Samsung evo plus 1tb nvme
RAM
32 gb G.Skill Tridentz 3200 mhz RGB
GPU
Zotac - RTX 3070 Ti Trinity OC
Monitor
ASUS TUF QHD 165hz IPS, ITEK GCF 165hz IPS QHD, Samsung Curvo 144hz QHD
PSU
Seasonic Focus 650w 80 platinum
Case
Coolermaster h500p
Periferiche
Asus Tuf Wireless
Net
Fibra Tim 100mb
OS
Windows 10 Pro 64 bit
Perfetto funziona grazie mille
 

Entra

oppure Accedi utilizzando
Discord Ufficiale Entra ora!

Discussioni Simili