Email Versand Localhost Test

  • PHP

    Email Versand Localhost Test

    Hallo,

    nach längerer Auszeit melde ich mal wieder mit einem Problem.

    Ich habe mich ein wenig in HTML und PHP eingearbeitet um die Firmenhomepage zu erstellen.

    Da das ganze noch nicht online gegangen ist, kann ich bisher nur lokal auf meinem Arbeitsgerät testen.

    Die Webseite funktioniert soweit wie gewünscht, außer der emailversandt.

    Dazu gibt es auf der zukünftigen Homepage ein Kontaktformular, welches eine Email versenden soll.

    Um das ganze zu testen, habe ich xampp installiert und eingerichtet. SMTP etc. ist der Gmail Dienst. In GoogleMail habe ich auch die Einstellungen angepasst, dass unsichere Drittanbieter zugelassen sind.

    Wenn ich jetzt eine email verschicke, kommt die eingerichtete Weiterleitung zu der "danke für Ihre Nachricht Seite"

    Die email kommt jedoch nicht an. Dafür bekomme ich eine Fehlermeldung im Apache-Error-Log
    das PHP.ini File ist folgendermaßen angepasst worden:

    ​SMTP= smtp.gmail.com
    smtp_port= 587
    sendmail_from = MeineEmail@gmail.com
    sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t
    und die sendmail.ini ist auch angepasst worden:
    ​smtp_server=smtp.gmail.com
    smtp_port=587smtp_ssl=autoAuth_username= ********Auth_password=********force_sender= mail@gmail.com
    die Angaben hab ich von einem tutorial...


    Kleine Anmerkung:
    Ich bin in China und verwende einen VPN in die USA (falls das Auswirkungen auf den Gmail Dienst haben sollte)

    Quellcode

    1. ​[Thu Nov 07 09:54:16.657398 2019] [mpm_winnt:crit] [pid 15744:tid 632] AH02538: Child: Parent process exited abruptly. Child process is ending
    2. [Thu Nov 07 09:54:17.826506 2019] [ssl:warn] [pid 12276:tid 636] AH01916: Init: (localhost:443) You configured HTTP(80) on the standard HTTPS(443) port!
    3. [Thu Nov 07 09:54:17.848457 2019] [core:warn] [pid 12276:tid 636] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
    4. [Thu Nov 07 09:54:17.852436 2019] [ssl:warn] [pid 12276:tid 636] AH01916: Init: (localhost:443) You configured HTTP(80) on the standard HTTPS(443) port!
    5. [Thu Nov 07 09:54:17.861408 2019] [mpm_winnt:notice] [pid 12276:tid 636] AH00455: Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.3.11 configured -- resuming normal operations
    6. [Thu Nov 07 09:54:17.861408 2019] [mpm_winnt:notice] [pid 12276:tid 636] AH00456: Apache Lounge VC15 Server built: Aug 11 2019 12:20:04
    7. [Thu Nov 07 09:54:17.861408 2019] [core:notice] [pid 12276:tid 636] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
    8. [Thu Nov 07 09:54:17.864373 2019] [mpm_winnt:notice] [pid 12276:tid 636] AH00418: Parent: Created child process 14220
    9. [Thu Nov 07 09:54:18.076835 2019] [ssl:warn] [pid 14220:tid 632] AH01916: Init: (localhost:443) You configured HTTP(80) on the standard HTTPS(443) port!
    10. [Thu Nov 07 09:54:18.095779 2019] [ssl:warn] [pid 14220:tid 632] AH01916: Init: (localhost:443) You configured HTTP(80) on the standard HTTPS(443) port!
    11. [Thu Nov 07 09:54:18.104755 2019] [mpm_winnt:notice] [pid 14220:tid 632] AH00354: Child: Starting 150 worker threads.
    12. Die Befehlszeile ist zu lang.


    Wobei ich bei dieser Fehlermeldung zwei Dinge nicht verstehe:

    1. warum und vor allem wo ist der Port80 konfiguriert? ich habe im xampp-verzeichnis mal mehrere Dateien durchsucht aber nirgends was mit port 80 gefunden. Die Google Suche hat mich das file httpd-ssl.conf checken lassen aber auch dort gibt es keinen port80

    2. was ist mit "die Befehlszeile ist zu lang" gemeint? Welche ist das?

    Das ist mein HTML code, welcher die email verschicken soll (zum php file weiterleitet)

    HTML-Quellcode

    1. <form id="myForm" method="post" action="form-mail.php">
    2. <fieldset><legend>Sending e-mail directly to us</legend>
    3. <div>
    4. <label for="name">Name:</label>
    5. <input type="text" name="name" id="name" placeholder="Your Name" required>
    6. <label id="error1"></label>
    7. </div>
    8. <div>
    9. <label for="mail">E-Mail:</label>
    10. <input type="email" name="mail" id="mail" placeholder="E-Mail-Address" required>
    11. <label for="mail" id="error2"></label>
    12. </div>
    13. <div>
    14. <label for="nachricht">Your Message:</label>
    15. <textarea name="nachricht" id="nachricht" placeholder="Please type in here your message" rows="10" required></textarea>
    16. <label for="nachricht" id="error3"></label>
    17. </div>
    18. <div>
    19. <input name="send" type="submit" value="Send">
    20. <input name="Reset" type="reset" value="Reset">
    21. </div>
    22. </fieldset>
    23. </form>


    das ist mein PHP-File

    PHP-Quellcode

    1. <?php
    2. $mailto = 'meineEmail@gmail.com'; // ist im Orginal natürlich meine Emailadresse
    3. $mailFrom = 'From-Mailer PHP-Script';
    4. $mailSubject = 'Feedback vom PHP-Formular';
    5. $returnPage = 'danke.html';
    6. $returnError = 'fehler.html';
    7. $mailContent = '';
    8. if(isset($_POST)) {
    9. foreach($_POST as $name => $value) {
    10. $mailContent .= $name . ": " . $value . "\n";
    11. }
    12. }
    13. $mailSent = mail($mailto, $mailSubject, $mailContent, "From: " . $mailFrom);
    14. if($mailSent == TRUE) {
    15. header("Location: " . $returnPage);
    16. }
    17. else {
    18. header("Location: " . $returnError);
    19. }
    20. exit();
    21. ?>



    Stimmt das so alles oder habe ich irgendwo einen Fehler gemacht?