screenshots for the file directory:
File directory
File directory, PHPMailer folder
Here is the code for send-email.php file:
<?php
//Import PHPMailer classes into the global namespace
//These must be at the top of your script, not inside a function
use PHPMailerPHPMailerPHPMailer;
use PHPMailerPHPMailerSMTP;
use PHPMailerPHPMailerException;
//Load Composer's autoloader
require 'PHPMailer/PHPMailerAutoload.php';
//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'smtp.ionos.de'; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = 'xxx'; //SMTP username
$mail->Password = 'xxx'; //SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
$mail->Port = xxx; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
//Recipients
$mail->setFrom('xxx', 'Nico');
$mail->addAddress('xxx', 'Emre'); //Add a recipient
//$mail->addAddress('[email protected]'); //Name is optional
//$mail->addReplyTo('[email protected]', 'Information');
//$mail->addCC('[email protected]');
//$mail->addBCC('[email protected]');
//Attachments
//$mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name
//Content
$mail->isHTML(true); //Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>
Here is the HTML code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--=============== FAVICON ===============-->
<link rel="shortcut icon" href="assets/img/restaurant-fill(4).png" type="image/x-icon">
<!--=============== REMIXICONS ===============-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/remixicon/4.1.0/remixicon.min.css">
<!--=============== CSS ===============-->
<link rel="stylesheet" href="assets/css/styles.css">
<title>NP Snacks and More</title>
</head>
<body>
<!--==================== HEADER ====================-->
<header class="header" id="header">
<nav class="nav container">
<a href="#" class="nav__logo">
<i class="ri-restaurant-fill"></i>
</a>
<div class="nav__menu" id="nav-menu">
<ul class="nav__list">
<li class="nav__item">
<a href="#home" class="nav__link active-link">Home</a>
</li>
<li class="nav__item">
<a href="#new" class="nav__link">Neues</a>
</li>
<li class="nav__item">
<a href="#shop" class="nav__link">Shop</a>
</li>
<!--<li class="nav__item">
<a href="#care" class="nav__link">Care</a>
</li>-->
<li class="nav__item">
<a href="#contact" class="nav__link">Kontakt</a>
</li>
</ul>
<!-- Close button -->
<div class="nav__close" id="nav-close">
<i class="ri-close-line"></i>
</div>
</div>
<div class="nav__actions">
<!--<i class="ri-user-line"></i>
<i class="ri-shopping-cart-line"></i>-->
<!-- Toggle button -->
<div class="nav__toggle" id="nav-toggle">
<i class="ri-menu-line"></i>
</div>
</div>
</nav>
</header>
<!--==================== MAIN ====================-->
<main class="main">
<!--==================== HOME ====================-->
<section class="home section" id="home">
<div class="home__container container grid">
<img src="assets/img/Logo.png" alt="image" class="home__img">
<div class="home__data">
<h1 class="home__title">
TASTIEST <br>
<span>SNACKS</span> FOR <br>
YOUR HUNGER <br>
</h1>
<p class="home__description">
Wir bieten Ihnen von klassischen Süßigkeiten
über verschiedenste Getränke,
bis hin zu Non Food Artikeln, eine große Auswahl an.
</p>
<!--wird noch nicht verwendet
<div class="home__buttons">
<a href="#" class="button">
<span>
<i class="ri-arrow-right-line"></i>
</span>
GO TO SHOP
</a>
<a href="#" class="button__link">MORE DETAILS</a>
</div>-->
</div>
</div>
</section>
<!--==================== NEWS ====================-->
<section class="new section" id="new">
<div class="new__container container grid">
<div class="new__data">
<h2 class="section__title">
Für den kleinen Hunger
</h2>
<p class="new__description">
Wöchentlich neue Ware. <br> darunter auch exoten im Sortiment
</p>
</div>
<div class="new__content grid">
<article class="new__card">
<img src="assets/img/Hofgut-Kakau.png" alt="image" class="new__img">
<h2 class="new__title">Hofgut Schokomilch</h2>
</article>
<article class="new__card">
<img src="assets/img/Takis-Fuego.png" alt="image" class="new__img">
<h2 class="new__title">Takis Fuego</h2>
</article>
<article class="new__card">
<img src="assets/img/Twix.png" alt="image" class="new__img">
<h2 class="new__title">Twix</h2>
</article>
</div>
</div>
</section>
<!--==================== SHOP ====================-->
<section class="shop section" id="shop">
<h2 class="section__title">
Einblick in unser Sortiment
</h2>
<div class="shop__container container grid">
<article class="shop__card">
<img src="assets/img/takis-blue.png" alt="image" class="shop__img">
<h3 class="shop__title">Takis <br> Blue Heat</h3>
<span class="shop__price"></span>
<button class="shop__button">
<i class="ri-shopping-bag-line"></i>
</button>
</article>
<article class="shop__card">
<img src="assets/img/Chips-Ahoy.png" alt="image" class="shop__img">
<h3 class="shop__title">Chips <br> Ahoy</h3>
<span class="shop__price"></span>
<button class="shop__button">
<i class="ri-shopping-bag-line"></i>
</button>
</article>
<article class="shop__card">
<img src="assets/img/Twix.png" alt="image" class="shop__img">
<h3 class="shop__title">Twix <br> Xtra</h3>
<span class="shop__price"></span>
<button class="shop__button">
<i class="ri-shopping-bag-line"></i>
</button>
</article>
<article class="shop__card">
<img src="assets/img/elfbar.png" alt="image" class="shop__img">
<h3 class="shop__title">Elfbar</h3>
<span class="shop__price"></span>
<button class="shop__button">
<i class="ri-shopping-bag-line"></i>
</button>
</article>
<article class="shop__card">
<img src="assets/img/Redbull.png" alt="image" class="shop__img">
<h3 class="shop__title">Red Bull</h3>
<span class="shop__price"></span>
<button class="shop__button">
<i class="ri-shopping-bag-line"></i>
</button>
</article>
<article class="shop__card">
<img src="assets/img/Takis-Fuego.png" alt="image" class="shop__img">
<h3 class="shop__title">Takis <br> Fuego</h3>
<span class="shop__price"></span>
<button class="shop__button">
<i class="ri-shopping-bag-line"></i>
</button>
</article>
</div>
</section>
<!--HIER KOMMEN DIE GENUTZTEN AUTOMATEN REIN-->
<section class="care section" id="care">
<h2 class="section__title">
Genutze Automaten <br> Sanden Vendo G Snack 10
</h2>
<div class="care__container container grid">
<img src="assets/img/Automat_gsnack.png" alt="image" class="care__img">
<ul class="care__list">
<li class="care__item">
<i class="ri-checkbox-fill"></i>
<p>
Der Sanden Vendo G-Snack 10 bietet eine vielseitige Auswahl an Snacks und Getränken,
einschließlich einer modularen Gestaltung für individuelle Anpassungen.
</p>
</li>
<li class="care__item">
<i class="ri-checkbox-fill"></i>
<p>
Mit seinem benutzerfreundlichen Touchscreen-Display und dem einfachen Bedienungskonzept ermöglicht der G-Snack 10 Kunden eine mühelose Produktauswahl.
</p>
</li>
<li class="care__item">
<i class="ri-checkbox-fill"></i>
<p>
Die Zuverlässigkeit und Wartungsfreundlichkeit des G-Snack 10 sind durch seine robuste Bauweise und leicht zugängliche Komponenten gewährleistet.
</p>
</li>
<li class="care__item">
<i class="ri-checkbox-fill"></i>
<p>
Durch energieeffiziente Funktionen wie LED-Beleuchtung und intelligenten Standby-Modus minimiert der G-Snack 10 den Stromverbrauch und ist umweltfreundlich.
</p>
</li>
</ul>
</div>
</section>
<!--==================== CONTACT ====================-->
<section class="contact section" id="contact">
<h2 class="section__title">
NEUGIERIG? <br> KONTAKTIEREN SIE UNS...
</h2>
<div class="contact__container container grid">
<img src="assets/img/Logo.png" alt="image" class="contact__img">
<div class="contact__content">
<div>
<h3 class="contact__title">Whatsapp, Instagram und<br> <br> Unternehmens-mail</h3>
<div class="contact__social">
xxx
<i class="ri-whatsapp-fill"></i>
</a>
<a href="https://www.instagram.com/np.snacks/" target="_blank">
<i class="ri-instagram-fill"></i>
</a>
<a href="[email protected]" target="_blank">
<i class="ri-mail-fill"></i>
</a>
</div>
</div>
<div>
<h3 class="contact__title">Rufen Sie uns an!</h3>
<address class="contact__info">
0177-2335729
</address>
</div>
<div>
<h3 class="contact__title">Unser Standort</h3>
<address class="contact__info">
xxx <br>
xxx
</address>
</div>
</div>
</div>
<div class="container-form">
<form method="post" action="send-email.php">
<h3>Kontaktieren Sie uns</h3>
<input type="text" name="name" id="name" placeholder="Ihr Name" required>
<input type="email" name="email" id="email" placeholder="Email" required>
<input type="phone" name="phone" id="phone" placeholder="Telefonnummer" required>
<input type="text" name="subject" id="subject" placeholder="Ihr Betreff" required>
<textarea name="message" id="message" placeholder="Ihr Anliegen" required></textarea>
<br>
<button>Send</button>
</form>
</div>
</section>
</main>
<!--Hier kommt ein Anmeldeformular rein-->
<!--==================== FOOTER ====================-->
<footer class="footer">
<div class="footer__container container grid">
<div class="footer__content grid">
<div>
<h3 class="footer__title">Unser Unternehmen</h3>
<ul class="footer__links">
<li>
<a href="impressum.html" class="footer__link">Impressum</a>
</li>
<li>
<a href="#shop" class="footer__link">Produkte</a>
</li>
<li>
<a href="AGBs.html" class="footer__link">AGB's</a>
</li>
</ul>
</div>
<div>
<h3 class="footer__title">INFOS</h3>
<ul class="footer__links">
<li>
<a href="#new" class="footer__link">Neues</a>
</li>
<li>
<a href="#contact" class="footer__link">Kontakt</a>
</li>
</ul>
</div>
<div>
<h3 class="footer__title">SOCIAL MEDIA</h3>
<div class="footer__social">
<a href="https://www.instagram.com/np.snacks/" target="_blank" class="footer__social-link">
<i class="ri-instagram-fill"></i>
</a>
</div>
</div>
</div>
</div>
<span class="footer__copy">
© IT and CAE Service Emre Boyraz | All Rights Reserved
</span>
</footer>
<!--========== SCROLL UP ==========-->
<a href="#" class="scrollup" id="scroll-up">
<i class="ri-arrow-up-line"></i>
</a>
<!--=============== SCROLLREVEAL ===============-->
<script src="assets/js/scrollreveal.min.js"></script>
<!--=============== MAIN JS ===============-->
<script src="assets/js/main.js"></script>
<!--=============== SMTP JS ===============-->
<script src="https://smtpjs.com/v3/smtp.js"></script>
</body>
</html>
My problem is, that i can’t get PHPMailer to work on my online host (IONOS).
I also double checked the SMTP Host an d also checked the correct directory of the PHPMailerAutoload.php
I already installed the PHPMAailer file as a zip in the online host directory.
Now here is the part that i don’t get.
In my Xampp local host it is working normally as it should.
To get an overview, the following links are the to know, where the files are located.
the system however doesn#t even recognizes the php file
Thnak 4 every discussion.
Emre Boyraz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.