Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hi All,

I'm using the testbed php email 2.3 example in my code. This works great!. I changed my server settings form sbc to gmail and now its broke.

The settings I'm using are in FM fields and I'm useing them in FM SMTP Server setting in the send mail function. Works great. The only differences I see are the Authenticate "plain password and ssl is checked. I do not have settings in my php code for these and are not sure they are available.

Things I've tried.

Did a google search for php gmail.

1. updating the code to PHPMail to 5.02. Did not work.

2. change my host to mail=>Host = 'ssl://smtp.gmail.com Did not work

3. I also learned there is specfic order to mail function.

/ create the mail object

$mail = new PHPMailer();

// specify that we want an SMTP connection

$mail->IsSMTP();

// set the SMTP host address

$mail->Host = $host;

// set the SMTP port, if any

if ( !empty($port) ) {

$mail->Port = $port;

}

// set the SMTP login credentials, if any

if ( !empty($username) ) {

$mail->SMTPAuth = TRUE;

$mail->Username = $username;

$mail->Password = $password;

$mail->SMTPDebug = $debugLevel;

}

Error Received:

SMTP -> Error: Failed to connect to Server: (0)

Error Info: smtp error: conld not connect to smtp host.

This is still not working.

Any suggestion would be appreciated.

I'm at my wits end.

Todd Dignan

  • Author

Here is the solution, tested with gmail and sbc

I add a couple of lines:

$mail->SMTPAuth = true; // enable SMTP authentication

$mail->SMTPSecure = "ssl";

Then I reordered the calls per the use_gmail.txt included in the phpMailer_v2.3 documentation.

// create the mail object

$mail = new PHPMailer();

// specify that we want an SMTP connection

$mail->IsSMTP();

$mail->SMTPAuth = true; // enable SMTP authentication

$mail->SMTPSecure = "ssl";

// set the SMTP host address

$mail->Host = $host;

// set the SMTP port, if any

if ( !empty($port) ) {

$mail->Port = $port;

}

// set the SMTP login username, if any

if ( !empty($username) ) {

$mail->Username = $username;

}

// set the SMTP login password, if any

if ( !empty($password) ) {

$mail->Password = $password;

}

// set the From address

$mail->From = $from;

// set the FromName, so the email doesn't arrive from Root User

$mail->FromName = $fromname;

// set the subject

$mail->Subject = $subject;

// set the body (and altbody, if any)

if ( !empty($htmlMessage) ) {

$mail->IsHTML(TRUE);

$mail->AltBody = $message;

$mail->Body= $htmlMessage;

} else {

$mail->IsHTML(FALSE);

$mail->Body = $message;

$mail->WordWrap = 50; // set word wrap

}

// set the ReplyTo address, if any

if ( !empty($replyTo) ) {

$mail->AddReplyTo($replyTo);

}

// set the CC addresses, if any

if ( !empty($ccs) ) {

$addresses = explode(',', $ccs);

foreach( $addresses as $address ) {

$mail->AddCC(trim($address));

}

}

// set the BCC addresses, if any

if ( !empty($bccs) ) {

$addresses = explode(',', $bccs);

foreach( $addresses as $address ) {

$mail->AddBCC(trim($address));

}

}

// set attachments, if any

if ( !empty($attachments) ) {

$paths = explode(',', $attachments);

foreach( $paths as $path ) {

$mail->AddAttachment(trim($path));

}

}

// set the To addresses

$addresses = explode(',', $tos);

foreach( $addresses as $address ) {

$mail->AddAddress(trim($address));

}

// send the message

if(!$mail->Send()) {

echo "Mailer Error: " . $mail->ErrorInfo;

} else {

echo "Message has been sent";

}

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.