Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress use SMTP instead of mail()
<?php
/**
* WordPress-Plugin use smtp instead of mail()
*
* PHP version 5.2
*
* @category PHP
* @package WordPress
* @subpackage UseSMTP
* @author Ralf Albert <me@neun12.de>
* @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.txt
* @version 1.0
* @link http://wordpress.com
*/
/**
* Plugin Name: UseSMTP
* Plugin URI: http://yoda.neun12.de
* Description: Using SMTP instead of mail()
* Version: 1.0
* Author: Ralf Albert
* Author URI: http://yoda.neun12.de
* License: GPLv3
*/
if( ! function_exists( 'usesmtp_init' ) ){
add_action( 'phpmailer_init', 'usesmtp_init' );
function usesmtp_init( $phpmailer ){
if( ! is_object( $phpmailer ) )
$phpmailer = (object) $phpmailer;
$phpmailer->Mailer = 'smtp'; // telling the class to use SMTP
// possible values are 'mail', 'sendmail' or 'smtp'
$phpmailer->Host = "mailserver-eintragen"; // set the SMTP server host
$phpmailer->Port = 465; // set the SMTP server port
$phpmailer->SMTPSecure = "ssl"; // enable SMTP via SSL
$phpmailer->SMTPAuth = true; // enable SMTP authentication
$phpmailer->Username = "benutzername"; // set the SMTP account username
$phpmailer->Password = "password"; // set the SMTP account password
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.