Topic: contact, email setting [SOLVED]

my sever
have not mailsever

i will use gmail (mailsever)

i don't know showkase<->gmail (mailsever) setting

help plz

Re: contact, email setting [SOLVED]

Please note that the Contact Form within Showkase requires PHP mail support on the server and this is the only method that is officially supported.

However, as Showkase uses PHPMailer internally, you could try the following.
Open the 'showkase/admin/plugins/contact/master/contactcore/contact.php' file in a plain text editor and change line 21 from:

$mailer->isMail();

... to:

//Tell PHPMailer to use SMTP
$mailer->isSMTP();

//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mailer->SMTPDebug = 2;

//Ask for HTML-friendly debug output
$mailer->Debugoutput = 'html';

//Set the hostname of the mail server
$mailer->Host = 'smtp.gmail.com';

// use
// $mailer->Host = gethostbyname('smtp.gmail.com');
// if your network does not support SMTP over IPv6
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mailer->Port = 587;

//Set the encryption system to use - ssl (deprecated) or tls
$mailer->SMTPSecure = 'tls';

//Whether to use SMTP authentication
$mailer->SMTPAuth = true;

//Username to use for SMTP authentication - use full email address for gmail
$mailer->Username = "username@gmail.com";

//Password to use for SMTP authentication
$mailer->Password = "yourpassword";

This code was taken from the gmail.phps example file from the PHPMailer package.

You will need to fill in your own unique SMTP details (as noted in the comments within the code).

You might also need to ensure that the 'From' address is a valid email address.
Try changing line 91 from:

$mailer->setFrom('mailer'.strstr($siteEmail, '@'), $userName);

... to:

$mailer->setFrom('username@gmail.com', $userName);

If you find that it does not work, then here are a few things to try.

  • Try setting Host to gethostbyname('smtp.gmail.com') instead of 'smtp.gmail.com'.

  • Try setting Port to 465 instead of 587.

  • Try setting SMTPSecure to 'ssl' instead of 'tls'.

  • If your Google account uses 2-Step-Verification, try using an App Password (and setting it as Username above).

  • Try allowing less secure apps to access your account.

There are other hints and tips on these troubleshooting pages:
PHPMailer: https://github.com/PHPMailer/PHPMailer/ … leshooting
StackOverflow: http://stackoverflow.com/questions/1604 … php-mailer

Please remember that this has not been tested and is not officially supported.

Re: contact, email setting [SOLVED]

<?php
/**
* Part of Showkase web site management package
*
* @package Showkase
* @author Jack Hardie {@link http://www.jhardie.com}
* @copyright Copyright (c) 2015, SimpleViewer Inc.
*/

error_reporting(E_ERROR);
ini_set('html_errors', 0);
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
    throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
}
set_error_handler("exception_error_handler");
date_default_timezone_set('UTC');
if (!$_POST) return;
require 'class.phpmailer.php';
$mailer = new PHPMailer(true);
$mailer->CharSet = 'utf-8';

/*$mailer->isMail();*/
//Tell PHPMailer to use SMTP
$mailer->isSMTP();

//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mailer->SMTPDebug = 2;

//Ask for HTML-friendly debug output
$mailer->Debugoutput = 'html';

//Set the hostname of the mail server
$mailer->Host = 'smtp.gmail.com';

// use
// $mailer->Host = gethostbyname('smtp.gmail.com');
// if your network does not support SMTP over IPv6
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mailer->Port = 587;

//Set the encryption system to use - ssl (deprecated) or tls
$mailer->SMTPSecure = 'tls';

//Whether to use SMTP authentication
$mailer->SMTPAuth = true;

//Username to use for SMTP authentication - use full email address for gmail
$mailer->Username = "jskno1@gmail.com";

//Password to use for SMTP authentication
$mailer->Password = "my password";




$mailer->isHTML(false);
$mailer->WordWrap = 78;
try {
    if (
        !isset($_SERVER['HTTP_X_REQUESTED_WITH'])
        && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest'
    ) {
        throw new Exception ('This program is for use by the Showkase contact form only');
    }
    if (get_magic_quotes_gpc()) {
        foreach($_POST as &$value) {
            $value = stripslashes($value);
        }
        unset($value);
    }
    $xmlSourcePath = $_POST['pagePath'].DIRECTORY_SEPARATOR.'page.xml';
    $xmlSource = @file_get_contents($xmlSourcePath);
    if ($xmlSource === false) {
        throw new Exception ('Cannot read page.xml file');
    }
    if ($xmlSource == '') {
        throw new Exception ('No content in page.xml file');
    }
    $domDoc = new DOMDocument();
    $domDoc->preserveWhiteSpace = false;
    $loaded = $domDoc->loadXML($xmlSource);
    if ($loaded === false) {
      $message = '';
      $errors = libxml_get_errors();
      foreach ($errors as $error) {
          $message .= 'XML error in page.xml, line '.$error->line.'. '.$error->message.'<br>';
      }
      libxml_clear_errors();
      throw new Exception($message);
    }
    $settingsTags = $domDoc->getElementsByTagName('settings');
    $tags = $settingsTags->item(0)->childNodes;
    foreach ($tags as $tag) {
      $vars[$tag->nodeName] = $tag->nodeValue;
    }
    // PHPMailer takes care of validation and sanitization
    $subject = isset($vars['ss_contactFormSubject'])
        ? $vars['ss_contactFormSubject']
        : '';
    $siteEmail = isset($vars['ss_contactFormTo'])
        ? $vars['ss_contactFormTo']
        : '';
    $response = isset($vars['ss_contactFormResponse'])
        ? $vars['ss_contactFormResponse']
        : '';
    $userName       = $_POST["userName"];
    $userEmail     = $_POST["userEmail"];
    $userMessage = $_POST["userMessage"];
    if(!PHPMailer::validateAddress($siteEmail)) {
          throw new Exception ('Site email address is not set or invalid');
    }
    if(strlen($userName) < 1){
          throw new Exception ('Please enter your name');
    }
    if(!PHPMailer::validateAddress($userEmail)) {
          throw new Exception ('Please enter a valid email');
    }
    if(strlen($userMessage) < 1){
          throw new Exception ('Please enter your message text');
    }
    if (stristr($siteEmail, '@') === '@example.com') {
        $output = json_encode(array('type'=>'message', 'text' => $response));
          die($output);
    }
//    $mailer->setFrom('mailer'.strstr($siteEmail, '@'), $userName);
$mailer->setFrom('jskno1@gmail.com', $userName);
    $mailer->addReplyTo($userEmail, $userName);
    $mailer->addAddress($siteEmail);
    $mailer->Subject = $subject;
    $mailer->Body =
        $userMessage
        ."\r\n\r\n"
        .$userName
        ."\r\n\r\n"
        .$userEmail;
    $mailer->send();
      $output = json_encode(array('type'=>'message', 'text' => $response));
      echo($output);
} catch (Exception $e) {
    $output = json_encode(array('type'=>'error', 'text' => $e->getMessage()));
    die($output);
}


do not operation

help plz

Re: contact, email setting [SOLVED]

I'm sorry to hear that my suggestion does not work.
Unfortunately, the code I posted above came straight from the PHPMailer Gmail example here so I'm not sure what else to suggest.

As I mentioned previously, the Contact Form within Showkase requires PHP mail support on the server and this is the only method that is officially supported.

The best thing to do might be to ask your web host if they could enable PHP mail support on your hosting account and you could then use Showkase's Contact Form without modification.

I realise that this is not a direct solution to your problem but it might be the best course of action.

Re: contact, email setting [SOLVED]

synology nas was the cause of the problem

I solved

It's working this way.

thx~~~

Re: contact, email setting [SOLVED]

I'm glad you've been able to resolve your problem.
Thank you for letting me know.