Local Community

Wp_mail not connecting

I am having a myriad of problems trying to get wp_mail to work. When it is called, the result is not picked up by mailhog.
Calling code

<?php add_action( 'phpmailer_init', 'send_smtp_email' ); function send_smtp_email( $phpmailer ) { echo "send setup
"; $phpmailer->isSMTP(); $phpmailer->Host = SMTP_HOST; $phpmailer->SMTPAuth = SMTP_AUTH; $phpmailer->Port = SMTP_PORT; $phpmailer->SMTPSecure = SMTP_SECURE; $phpmailer->Username = SMTP_USERNAME; $phpmailer->Password = SMTP_PASSWORD; $phpmailer->From = SMTP_FROM; $phpmailer->FromName = SMTP_FROMNAME; } function fj_main(){ $subject="seventh virgin try"; $message="did i get there"; $to="lyond@essex.ac.uk"; echo "befor
"; $ok=wp_mail($to, $subject, $message); echo "after
"; if ($ok) {echo "good";} else {echo "bad";} //var_dump($ok); } wp_config setup /* DML settings for email using Virgin */ define( 'SMTP_HOST', 'smtp.virginmedia.com' ); // A2 Hosting server name. For example, "a2ss10.a2hosting.com" define( 'SMTP_AUTH', true ); define( 'SMTP_PORT', '465' ); define( 'SMTP_SECURE', 'ssl' ); define( 'SMTP_USERNAME', 'David Lyons' ); // Username for SMTP authentication define( 'SMTP_PASSWORD', 'ferm1shed' ); // Password for SMTP authentication define( 'SMTP_FROM', 'fleecejazz@virginmedia.com' ); // SMTP From address define( 'SMTP_FROMNAME', 'Fleece Jazz' ); // SMTP From name mailbag doesn't catch it. fleecejazz@virginmedia.com works perfectly from the virgin website, send and receive. I admit to being pretty hazy about the smtp protocol. Also, how do you turn mailbag off? Local is great, by the way. Dave Lyons

Sorry, I am an idiot again.
I am having a myriad of problems trying to get wp_mail to work. When it is called, the result is not picked up by mailhog.
Calling code

function main() (

add_action( 'phpmailer_init', 'send_smtp_email' );
function send_smtp_email( $phpmailer ) {
    echo "send setup<br/>";
    $phpmailer->isSMTP();
    $phpmailer->Host       = SMTP_HOST;
    $phpmailer->SMTPAuth   = SMTP_AUTH;
    $phpmailer->Port       = SMTP_PORT;
    $phpmailer->SMTPSecure = SMTP_SECURE;
    $phpmailer->Username   = SMTP_USERNAME;
    $phpmailer->Password   = SMTP_PASSWORD;
    $phpmailer->From       = SMTP_FROM;
    $phpmailer->FromName   = SMTP_FROMNAME;
}

function fj_main(){
    //$ok=file_get_contents('/Users/davidlyons/Local Sites/temp/app/public/email.html', FALSE, NULL, 0, 35000);//reads into a variable
    //$ok=file('/Users/davidlyons/Local Sites/temp/wp-admin/post.php?post=334&action=edit'); //reads into an array
    //$ok=file('/Users/davidlyons/Local Sites/temp/app/public/email.html');
    $subject="seventh virgin try";
    $message="did i get there";
    $to="lyond@essex.ac.uk";
    
    $ok=wp_mail($to, $subject, $message);
    echo "after<br/>";
    if ($ok) {echo "good";} else {echo "bad";}


    //var_dump($ok);

}

wp_config setup

/* DML settings for email using Virgin */
define( ‘SMTP_HOST’, ‘smtp.virginmedia.com’ ); // A2 Hosting server name. For example, “a2ss10.a2hosting.com
define( ‘SMTP_AUTH’, true );
define( ‘SMTP_PORT’, ‘465’ );
define( ‘SMTP_SECURE’, ‘ssl’ );
define( ‘SMTP_USERNAME’, ‘David Lyons’ ); // Username for SMTP authentication
define( ‘SMTP_PASSWORD’, ‘ferm1shed’ ); // Password for SMTP authentication
define( ‘SMTP_FROM’, ‘fleecejazz@virginmedia.com’ ); // SMTP From address
define( ‘SMTP_FROMNAME’, ‘Fleece Jazz’ ); // SMTP From name

mailbag doesn’t catch it. fleecejazz@virginmedia.com works perfectly from the virgin website, send and receive.

I admit to being pretty hazy about the smtp protocol.

Also, how do you turn mailbag off?

Local is great, by the way.

Dave Lyons