Benutzer-Werkzeuge

Webseiten-Werkzeuge


Seitenleiste

3D

INTERN

ADOBE

ARDUINO

BITBUCKET

DOCKER

C4D

GIT

HTML

IPHONE

JAVASCRIPT

JTL-SHOP

LARAVEL

MAGENTO2

MYSQL

PHP

PLESK

PROCESSING

PYTHON

SUITECRM

SEO

TRYTON

THUNDERBIRD / ICEDOVE / FossaMail

TYPO3

TYPO3: BACKEND

TYPO3: TYPOSCRIPT

UNIX

VLC

VVVV

WINDOWS

WINDOWS 10

WORDPRESS

XAMPP

XT:C 4 (Veyton)

xampp:set-up-mercury-for-email-debugging-with-php-sendmail

XAMPP: set up mercury to receive emails send by local php scripts via sendmail

Description:

In order to debug e-mails of e.g. a shop system i need to be able to let php scripts send out emails which are locally delivered.

I am going to set up 2 local accounts

  • local-user@localhost.com
  • local-owner@localhost.com

The idea is that a site user (e.g. some shop client) is local-user and the Shop System Owner (e.g. merchant) is local-owner. So a testing setup can deliver e-mails to both parties. Those e-mails i can review in different clients and possibly iterate fast on changes or bugs etc.

Host File

To be able to use FQDN e-mail Adresses (localhost.com instead of localhost) i did add localhost.com to the host file and let it point to me.

Add following line to your host file C:\Windows\System32\drivers\etc\hosts

127.0.0.1 localhost.com

Mercury Settings

Working Instructions are taken from C-Sharpcorner [1] and system66 [2]

00. Adding users and aliases

  1. start xampp, start mercury, click on mercuries admin
  2. goto: configuration>manage local users
  3. optional: delete newuser
  4. add: Username: local-user, assign password
  5. add: Username: local-owner, assign passwort
  6. goto: configuration>Aliases
  7. Add new alias: Alias:local-user@localhost.com; Real address: local-user@localhost
  8. Add new alias: Alias:local-owner@localhost.com; Real address: local-owner@localhost
  9. Save

01. Add localhost.com as valid local domain

  1. goto: configuration>Mercury core module
  2. goto: Local domains
  3. Add new domain: Local host or server: localhost.com; Internet name: [127.0.0.1]

02. Configure SMTP and POP3 Server

  1. goto: configuration>MercuryS SMTP Server
  2. put: Anounce myself as: 127.0.0.1 and IP Interface to use: 127.0.0.1
  3. click: OK
  4. goto: configuration>MercuryP Pop3 server
  5. put: IP interface to use: 127.0.0.1
  6. click: OK

03. Configure SMTP and POP3 Clients

  1. goto: configuration>MercuryE SMTP Client
  2. put: Identify myself as: 127.0.0.1
  3. put: Name servers: 127.0.0.1
  4. click: save
  5. goto: configuration>Mercury D POP3 Client
  6. click: Add
  7. put: POP3 Host: 127.0.0.1
  8. put: Username: local-owner, Password: somepassword
  9. click: OK
  10. click: SAVE

Sendmail and php.ini

c:\xampp\sendmail\sendmail.ini was modified

smtp_server=localhost.com
smtp_ssl=none
auth_username=local-owner@localhost.com
auth_password=thepass

C:\xampp\php\php.ini was modified (after serching the php.ini for 'sendmail' following parameters have been uncommented / commented)

SMTP = localhost
smtp_port = 25
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
#sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
mail.log = "C:\xampp\php\logs\php_mail.log"

Client Config (here FossaMail)

TestScript testmail.php

<?php
//php code to send mail, 
//author : idrish laxmidhar
//Use this code to send a test mail from your localhost.
 
$to = "local-user@localhost.com";
$subject = "Hi!";
$body="test".PHP_EOL;
$body.="Hello World. If all went well then you can see this mail in your Inbox".PHP_EOL;
$body.="Regards".PHP_EOL;
$body.="Idrish Laxmidhar".PHP_EOL;
$body.="http://i-tech-life.blogspot.com".PHP_EOL;
 
$headers = "From: local-owner@localhost.com"; 
 
if (mail($to, $subject, $body, $headers)) {
echo("Message successfully sent!
");
} else {
echo("Message delivery failed...
");
}
?>
xampp/set-up-mercury-for-email-debugging-with-php-sendmail.txt · Zuletzt geändert: 2016/08/15 14:58 von admin