Using SMTP instead of mail....

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
User avatar
alex4orly
 
 
Posts: 557
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Using SMTP instead of mail....

Post by alex4orly » Fri Aug 03, 2018 9:08 am

Well folks, I found out that using a sample of PHPMailer class from Github produces a script that actually works.
I am yet to figure out how to combine this with the actual page HTM code generated by WWB, but the code below works for some reason, whereas the code produced from WWB deosn't for some reason.

I am not that big specialist with PHP (far from) and can't tell what is the difference...

Here is the code that was generated and works - sends me an SMTP email

Cheers

===================================
<?php
require_once '../PHPMailerAutoload.php';

$results_messages = array();

$mail = new PHPMailer(true);
$mail->CharSet = 'utf-8';

class phpmailerAppException extends phpmailerException {}

try {
$to = 'alex4orly@gmail.com';
if(!PHPMailer::validateAddress($to)) {
throw new phpmailerAppException("Email address " . $to . " is invalid -- aborting!");
}
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Host = "80.244.168.40";
$mail->Port = "25";
$mail->SMTPSecure = "none";
$mail->SMTPAuth = true;
$mail->Username = "webmaster@squadron-125.org.il";
$mail->Password = "******";
$mail->addReplyTo("webmaster@squadron-125.org.il", "מנהל האתר");
$mail->From = "webmaster@squadron-125.org.il";
$mail->FromName = "מנהל האתר";
$mail->addAddress("alex4orly@gmail.com", "אלכס אוונס");
$mail->Subject = "יצירת קשר מהאתר(PHPMailer test using SMTP)";
$body = <<<'EOT'
שלום לכם נקניקים קטנים
EOT;
$mail->WordWrap = 80;
$mail->msgHTML($body, dirname(__FILE__), true); //Create message bodies and embed images
$mail->addAttachment('images/phpmailer_mini.png','phpmailer_mini.png'); // optional name
$mail->addAttachment('images/phpmailer.png', 'phpmailer.png'); // optional name

try {
$mail->send();
$results_messages[] = "Message has been sent using SMTP";
}
catch (phpmailerException $e) {
throw new phpmailerAppException('Unable to send to: ' . $to. ': '.$e->getMessage());
}
}
catch (phpmailerAppException $e) {
$results_messages[] = $e->errorMessage();
}

if (count($results_messages) > 0) {
echo "<h2>Run results</h2>\n";
echo "<ul>\n";
foreach ($results_messages as $result) {
echo "<li>$result</li>\n";
}
echo "</ul>\n";
}
?>

User avatar
Pablo
 
Posts: 14141
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Using SMTP instead of mail....

Post by Pablo » Fri Aug 03, 2018 9:51 am

I do not see any major differences with the code generated by WWB.
What is the WWB code with your settings?

To implement your own form process please see:
http://wysiwygwebbuilder.com/forms_php.html
replace the PHP code with what works for you.

lummis
 
 
Posts: 99
Joined: Sun Apr 24, 2011 9:18 am
Location: UK

Re: Using SMTP instead of mail....

Post by lummis » Fri Aug 03, 2018 9:04 pm

As a matter of interest, Alex, does this script solve your RTL problem?

Brian

User avatar
alex4orly
 
 
Posts: 557
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Using SMTP instead of mail....

Post by alex4orly » Fri Aug 03, 2018 9:15 pm

Brian,

A long way to go before I know and can answer this.
The reason I persist with the SMTP is that it seems that there is a better chance for it to be solved, but not with mail()

Will report here when I know...
Cheers
Alex

P.S - where in the world are you located?

lummis
 
 
Posts: 99
Joined: Sun Apr 24, 2011 9:18 am
Location: UK

Re: Using SMTP instead of mail....

Post by lummis » Fri Aug 03, 2018 9:18 pm

P.S - where in the world are you located?
As it says on the right hand side under my name - Location UK, or more precisely in the county of Suffolk , England. :)

User avatar
alex4orly
 
 
Posts: 557
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Using SMTP instead of mail....

Post by alex4orly » Sat Aug 04, 2018 6:47 am

Pablo wrote:
Fri Aug 03, 2018 9:51 am
To implement your own form process please see:
http://wysiwygwebbuilder.com/forms_php.html
replace the PHP code with what works for you.
I followed the steps in the tutorial and:

I am inserting below my PHP code, I do not see how to stop the message from being sent as soon as it loads, before I get a chance to fill in the details and click the Submit button
=========================================================

<?PHP
require_once './PHPMailerAutoload.php';

$mail = new PHPMailer(true);
$mail->CharSet = 'utf-8';

$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->Host = "80.244.168.40";
$mail->Port = "25";
$mail->SMTPSecure = "none";
$mail->SMTPAuth = true;
$mail->Username = "webmaster@squadron-125.org.il";
$mail->Password = "****";
$mail->addReplyTo("webmaster@squadron-125.org.il", "מנהלת אתר 125");
$mail->From = "webmaster@squadron-125.org.il";
$mail->FromName = "מנהלת אתר 125";
//$mail->addAddress("alex4orly@gmail.com", "אלכס אוונס");
$mail->addAddress(isset($_POST['email']));

$mail->Subject = "יצירת קשר מאתר טייסת - 125";

$body = ".חברים ותיקים שלום לכם";

$mail->WordWrap = 80;
$mail->msgHTML($body);

$mail->send();
?>

lummis
 
 
Posts: 99
Joined: Sun Apr 24, 2011 9:18 am
Location: UK

Re: Using SMTP instead of mail....

Post by lummis » Sat Aug 04, 2018 7:57 am

It was hot and steamy here last night so my brain was not functioning well. On looking at the script this morning I see that you now have the IP address for your host. So have you tried placing that address of 80.244.168.40 in the Mail Engine, in the space for SMPT host, in the form that you referred to in you other post. That may be your easiest option - if it doesn't work then there is still something wrong with the settings and you may have to try unticking the SMPT Authentication or refer back to the host.

Brian
Last edited by lummis on Sat Aug 04, 2018 8:04 am, edited 1 time in total.

User avatar
alex4orly
 
 
Posts: 557
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Using SMTP instead of mail....

Post by alex4orly » Sat Aug 04, 2018 8:04 am

Good morning to the M25...

Well Brian, It turns out - this IP or the website URL are the same thing... Their setup is redirecting any visits depending on the nature to the approprite server (Probably though the HTTP headers...)
Anyway, that didn't make any difference.

So, as you can see from the message previous to yours, I followed Pablo's advice and created a form with my onw PHP script, this works just fine with SMTP, now I need to figure out how to make the form NOT submit, until the actual button is not clicked... As it stands, the email goes out with the hard coded information without any data from the form, nor any clicks as soon as the page is loaded...

I am still learning...

Cheers
Alex

User avatar
Pablo
 
Posts: 14141
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Using SMTP instead of mail....

Post by Pablo » Sat Aug 04, 2018 10:57 am

As it stands, the email goes out with the hard coded information without any data from the form, nor any clicks as soon as the page is loaded...
I think it's best if you try to figure out what the difference is with the built-in script. It may just be one setting.
If you can get the built-in script working then you do not have to write any additional code yourself.

User avatar
alex4orly
 
 
Posts: 557
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Using SMTP instead of mail....

Post by alex4orly » Sun Aug 05, 2018 1:08 am

OK, I went that way - by elimination and here are my findings:
When publishing ALL files in WWB, it produces the following files
contactform.php - this is my actual page including the dialog / html page itself
phpmailerautoload.php - there is no problem with this file
class.smtp.php - there is no problem with this file
class.phpmailer.php - this seems to be the culprit

http://www.squadron-125.org.il/class.phpmailer_wwb.php which as you can see I renamed and uploaded instead the file that works from github.

Now, I will leave you with it, if you want I can email to you the 3 files that are from git hub, maybe you can figure out why? For now - the SMTP works for me, I need to go and continue to resolve the RTL /Hebrew problem

Cheers

User avatar
Pablo
 
Posts: 14141
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Using SMTP instead of mail....

Post by Pablo » Sun Aug 05, 2018 7:16 am

class.phpmailer.php
This file came directly from the github, it was not modified in any way.

Which version do you use?

User avatar
alex4orly
 
 
Posts: 557
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Using SMTP instead of mail....

Post by alex4orly » Sun Aug 05, 2018 7:18 am

OK, resolved also the RTL problem, it looks like this :
http://www.squadron-125.org.il/RTLEmail.jpg

The solution was staring me in the face... All I had to do was to encapsulate the message in between
<p dir="rtl"> and </p> and make it look like this

<p dir="rtl">
<font style="color:#000000;font-family:arial;font-size:16px"><strong>פרטי ההודעה</strong><br>
<br>
שם השולח : $Sendername <br>
כתבת המייל: $email <br>
מספר הטלפון: $Phone <br>
<br>
$MessageContent</font><font style="color:#000000;font-family:ms shell dlg;font-size:11px">
</font><font style="color:#000000;font-family:arial;font-size:16px"></font>
</p>

I do still have a problem. The actual message body itself, ignores line breaks and doens't follow the RTL when it comes to full stop and punctuation for end of line. The body text in the above image was entered as two lines, but thescript ignores it...

Any idea what can I do with that?

Cheers

User avatar
Pablo
 
Posts: 14141
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Using SMTP instead of mail....

Post by Pablo » Sun Aug 05, 2018 1:35 pm

I don't think line-breaks will automatically be converted to <br> by the browser. This requires a script to process the input.

User avatar
alex4orly
 
 
Posts: 557
Joined: Mon Jan 20, 2014 8:17 am
Location: Australia
Contact:

Re: Using SMTP instead of mail....

Post by alex4orly » Sun Aug 05, 2018 8:43 pm

Yes, after reading some more on the topic it seems you are right, but I can live with that for now.

The issue that is however more inmopprtant is
class.phpmailer.php - this seems to be the culprit
Until you can fix it, each time WWB publishes the page, I have to go and override that file with my own. Is there a way I can execute a "Copy" command automatically AFTER page publishing finished?

Thanks

User avatar
Pablo
 
Posts: 14141
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Using SMTP instead of mail....

Post by Pablo » Mon Aug 06, 2018 6:56 am

Is there a way I can execute a "Copy" command automatically AFTER page publishing finished?
I'm sorry, there is no option to do that.

Note that the new version of phpmailer 6 is not 100% compatible with the previous versions, so that is why WWB still uses version 5.x

From the documentation:
PHPMailer 6.0 is a major update, breaking backward compatibility.
It will require extensive testing before I can include the new version to make sure everything still works the same way.
That will take some time.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests