vfn
January 20, 2022, 2:08pm
1
Hi there clever people i a little bit of extra help with email/mailer.
i have a IIS with PHP and i have a php page with a email script. if i run it i get an email straight back, but cant figure it out how to setup in wappler.
my script
<?php
ini_set( ‘display_errors’, 1 );
error_reporting( E_ALL );
$from = “myemail@email.com ”;
$to = “to@email.com ”;
$subject = “PHP Mail Test script”;
$message = “This is a test to check the PHP Mail functionality”;
$headers = “From:” . $from;
mail($to,$subject,$message, $headers);
echo “Test email sent”;
?>
so the above runs perfectly on the same website!!
any help would be appreciated.
regards vitor
Teodor
January 20, 2022, 2:16pm
2
As usual for problems like this:
You can easily debug issues related to server-side processing such as - form not sending email, record not inserting or updating, query not showing data etc.
The first thing you need to do is to open the server connect settings. They are located in the Workflows Panel > Server Actions:
[Screenshot 2021-09-27 at 10.02.35]
And enable the Debug Mode:
[Screenshot 2021-09-27 at 10.03.08]
Click Save:
[Screenshot 2021-09-27 at 10.03.26]
In your browser, open the Developer tools. If you don’t k…
vfn
January 20, 2022, 2:19pm
3
done it, but dont tell me much!!
Teodor
January 20, 2022, 2:20pm
4
Well, please provide the exact error message you see.
vfn
January 20, 2022, 2:21pm
5
i dont get an error message, dont get an email, the developer tools are only the error message.
when i submit the form i dont get an email
Teodor
January 20, 2022, 2:26pm
6
Check the tutorial i sent you.
It’s explained there where to find the error in the dev tools. Post a screenshot of the error you see in dev tools.
Peter
January 20, 2022, 2:36pm
7
Not sure if this is even the problem but have you tried ticking Use SSL ?
vfn
January 20, 2022, 3:15pm
8
strange in the iis/php i dont get any errors!!
uploaded this to the php server and i get this
this is using the smtp.office365.com
port 587
{code: 2, file: “C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php”, line: 1574,…}
code: 2
file: “C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php”
line: 1574
message: “Message body empty”
trace: “#0 C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php(1482): PHPMailer\PHPMailer\PHPMailer->preSend()\n#1 C:\wamp64\www\wappler\dmxConnectLib\modules\mail.php(133): PHPMailer\PHPMailer\PHPMailer->send()\n#2 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(195): modules\mail->send(Object(stdClass), ‘’, NULL)\n#3 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(127): lib\App->execSteps(Object(stdClass))\n#4 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(116): lib\App->exec(Object(stdClass), false)\n#5 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(94): lib\App->exec(Object(stdClass))\n#6 C:\wamp64\www\wappler\dmxConnect\api\sendemail.php(8): lib\App->define(Object(stdClass))\n#7 {main}”
mimuk
January 20, 2022, 3:39pm
9
Strangely and maybe unrelated, but I have errors sending emails too. (IIS and ASP Classic)
"type":"Error","fileName":"lib/mail/mailer.asp","lineNumber":41,"errorNumber":-2147220960,"message":"The \"SendUsing\" configuration value is invalid.\r\n","stack"
Tried with my office365 and hosted SMTP server credentials
vfn
January 20, 2022, 3:41pm
10
vfn:
<?php
ini_set( ‘display_errors’, 1 );
error_reporting( E_ALL );
$from = “[myemail@email.com](mailto:myemail@email.com)”;
$to = “[to@email.com](mailto:to@email.com)”;
$subject = “PHP Mail Test script”;
$message = “This is a test to check the PHP Mail functionality”;
$headers = “From:” . $from;
mail($to,$subject,$message, $headers);
echo “Test email sent”;
?>
i tried the email script (at the top of the page and sends the email perfectly!
trying to find a tutorial on form to email on the latest version to make sure i have not missed a step!!
Teodor
January 20, 2022, 3:42pm
11
vfn:
message: “Message body empty”
The error says the message body is empty. Are you sure you are not sending an empty mail?
vfn
January 20, 2022, 4:16pm
12
going crazy here!!! lol
this are my settings
these are my settings below
the errors i get are…
Preview (developers tools)
{
“code”: 2,
“file”: “C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php”,
“line”: 1977,
“message”: “SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting ”,
“trace”: “#0 C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php(1648): PHPMailer\PHPMailer\PHPMailer->smtpSend(‘Date: Thu, 20 J…’, ‘This is a multi…’)\n#1 C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php(1486): PHPMailer\PHPMailer\PHPMailer->postSend()\n#2 C:\wamp64\www\wappler\dmxConnectLib\modules\mail.php(133): PHPMailer\PHPMailer\PHPMailer->send()\n#3 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(195): modules\mail->send(Object(stdClass), ‘’, NULL)\n#4 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(127): lib\App->execSteps(Object(stdClass))\n#5 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(116): lib\App->exec(Object(stdClass), false)\n#6 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(94): lib\App->exec(Object(stdClass))\n#7 C:\wamp64\www\wappler\dmxConnect\api\sendemail.php(8): lib\App->define(Object(stdClass))\n#8 {main}”
}
response (developer tools)
{“code”:2,“file”:“C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php”,“line”:1977,“message”:“SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting",“trace”:"#0 C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php(1648): PHPMailer\PHPMailer\PHPMailer->smtpSend(‘Date: Thu, 20 J…’, ‘This is a multi…’)\n#1 C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php(1486): PHPMailer\PHPMailer\PHPMailer->postSend()\n#2 C:\wamp64\www\wappler\dmxConnectLib\modules\mail.php(133): PHPMailer\PHPMailer\PHPMailer->send()\n#3 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(195): modules\mail->send(Object(stdClass), ‘’, NULL)\n#4 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(127): lib\App->execSteps(Object(stdClass))\n#5 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(116): lib\App->exec(Object(stdClass), false)\n#6 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(94): lib\App->exec(Object(stdClass))\n#7 C:\wamp64\www\wappler\dmxConnect\api\sendemail.php(8): lib\App->define(Object(stdClass))\n#8 {main}”}
Teodor
January 20, 2022, 4:18pm
13
Well, the error message is now saying:
Which means there is an issue connecting to your SMTP server.
In order to show the exact error returned by the SMTP server you can:
Open the following file in your site root:
/dmxConnectLib/PHPMailer/PHPMailer/PHPMailer.php
and edit line 401 from:
to
public $SMTPDebug = 3;
save the file and try sending the mail once again. You will see more detailed error in the console - please paste it here.
vfn
January 20, 2022, 4:30pm
14
here it goes The amazing number 3!!
2022-01-20 16: 29: 04 Connection: opening to ssl: //smtp.office365.com:587 , timeout=300, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)
2022-01-20 16:29:04 Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:error:1408F10B:SSL routines:ssl3_get_record:wrong version number [C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\SMTP.php line 388]
2022-01-20 16:29:04 Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\SMTP.php line 388]
2022-01-20 16:29:04 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://smtp.office365.com:587 (Unknown error) [C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\SMTP.php line 388]
2022-01-20 16:29:04 SMTP ERROR: Failed to connect to server: (0)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
{“code”:2,“file”:“C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php”,“line”:1977,“message”:“SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting",“trace”:"#0 C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php(1648): PHPMailer\PHPMailer\PHPMailer->smtpSend(‘Date: Thu, 20 J…’, ‘This is a multi…’)\n#1 C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php(1486): PHPMailer\PHPMailer\PHPMailer->postSend()\n#2 C:\wamp64\www\wappler\dmxConnectLib\modules\mail.php(133): PHPMailer\PHPMailer\PHPMailer->send()\n#3 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(195): modules\mail->send(Object(stdClass), ‘’, NULL)\n#4 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(127): lib\App->execSteps(Object(stdClass))\n#5 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(116): lib\App->exec(Object(stdClass), false)\n#6 C:\wamp64\www\wappler\dmxConnectLib\lib\App.php(94): lib\App->exec(Object(stdClass))\n#7 C:\wamp64\www\wappler\dmxConnect\api\sendemail.php(8): lib\App->define(Object(stdClass))\n#8 {main}”}
Teodor
January 20, 2022, 4:41pm
15
Doesn’t seem like a problem with the mailer script. Please see:
opened 06:08PM - 27 Dec 17 UTC
closed 08:27PM - 30 Dec 17 UTC
Please do not close this error , because i think is caused by PHPEmailer.
Warning: stream_socket_enable_crypto(): SSL operation failed with code 1....
and
patrick
January 20, 2022, 4:47pm
16
I believe for the port 587 which uses STARTTLS you need to uncheck the Use SSL
, is connects first without SSL and uses STARTTLS command to switch to SSL.
vfn
January 20, 2022, 4:49pm
17
vfn:
<?php
ini_set( ‘display_errors’, 1 );
error_reporting( E_ALL );
$from = “[myemail@email.com](mailto:myemail@email.com)”;
$to = “[to@email.com](mailto:to@email.com)”;
$subject = “PHP Mail Test script”;
$message = “This is a test to check the PHP Mail functionality”;
$headers = “From:” . $from;
mail($to,$subject,$message, $headers);
echo “Test email sent”;
?>
thanks for this ... i am reading.
strange if i run this.. it works!
<?php
ini_set( ‘display_errors’, 1 );
error_reporting( E_ALL );
$from = “[myemail@email.com](mailto:myemail@email.com)”;
$to = “[to@email.com](mailto:to@email.com)”;
$subject = “PHP Mail Test script”;
$message = “This is a test to check the PHP Mail functionality”;
$headers = “From:” . $from;
mail($to,$subject,$message, $headers);
echo “Test email sent”;
?>
this is my php.ini
email part
[mail function]
; For Win32 only.
; PHP: Runtime Configuration - Manual
SMTP = smtp.office365.com
; PHP: Runtime Configuration - Manual
smtp_port = 587
; For Win32 only.
; PHP: Runtime Configuration - Manual
sendmail_from ="support@mydomain.com "
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; PHP: Runtime Configuration - Manual
sendmail_path ="C:\wamp64\Sendmail\sendmail.exe"
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail().
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off
; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
; Log mail to syslog (Event Log on Windows).
;mail.log = syslog
vfn
January 20, 2022, 4:59pm
18
i have change the server name with
tls://smtp.office365.com
and now i get this
2022-01-20 16:54:37 Connection: opening to smtp.office365.com:587 , timeout=300, options=array ( ‘ssl’ => array ( ‘verify_peer’ => false, ‘verify_peer_name’ => false, ‘allow_self_signed’ => true, ),)
2022-01-20 16:54:37 Connection: opened
2022-01-20 16:54:37 SERVER -> CLIENT: 220 LNXP265CA0047.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 20 Jan 2022 16:54:37 +0000
2022-01-20 16:54:37 CLIENT -> SERVER: EHLO 10.0.2.207
2022-01-20 16:54:37 SERVER -> CLIENT: 250-LNXP265CA0047.outlook.office365.com Hello [2a02:c7e:1c46:f500:a4d9:2b73:c4be:62b0]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-STARTTLS250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2022-01-20 16:54:37 CLIENT -> SERVER: STARTTLS
2022-01-20 16:54:37 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
2022-01-20 16:54:37 CLIENT -> SERVER: EHLO 10.0.2.207
2022-01-20 16:54:37 SERVER -> CLIENT: 250-LNXP265CA0047.outlook.office365.com Hello [2a02:c7e:1c46:f500:a4d9:2b73:c4be:62b0]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH LOGIN XOAUTH2250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2022-01-20 16:54:37 CLIENT -> SERVER: AUTH LOGIN
2022-01-20 16:54:37 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2022-01-20 16:54:37 CLIENT -> SERVER: [credentials hidden]
2022-01-20 16:54:37 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2022-01-20 16:54:37 CLIENT -> SERVER: [credentials hidden]
2022-01-20 16:55:14 SERVER -> CLIENT: 235 2.7.0 Authentication successful
2022-01-20 16:55:14 CLIENT -> SERVER: MAIL FROM:helpdesk@mydomain.com
2022-01-20 16:55:14 SERVER -> CLIENT: 250 2.1.0 Sender OK
2022-01-20 16:55:14 CLIENT -> SERVER: RCPT TO:helpdesk@mydomain.com
2022-01-20 16:55:14 SERVER -> CLIENT: 250 2.1.5 Recipient OK
2022-01-20 16:55:14 CLIENT -> SERVER: DATA
2022-01-20 16:55:14 SERVER -> CLIENT: 354 Start mail input; end with .
2022-01-20 16:55:14 CLIENT -> SERVER: Date: Thu, 20 Jan 2022 16:54:37 +0000
2022-01-20 16:55:14 CLIENT -> SERVER: To: helpdesk helpdesk@mydomain.com
2022-01-20 16:55:14 CLIENT -> SERVER: From: test user helpdesk@mydomain.com
2022-01-20 16:55:14 CLIENT -> SERVER: Reply-To: helpdesk@mydomain.com
2022-01-20 16:55:14 CLIENT -> SERVER: Subject: aasasa
2022-01-20 16:55:14 CLIENT -> SERVER: Message-ID: a2ItEW9nBzK7kPmJiRHED4WAXNzfbqK7NDjARitg1c@10.0.2.207
2022-01-20 16:55:14 CLIENT -> SERVER: X-Mailer: PHPMailer 6.5.1 (https://github.com/PHPMailer/PHPMailer )
2022-01-20 16:55:14 CLIENT -> SERVER: MIME-Version: 1.0
2022-01-20 16:55:14 CLIENT -> SERVER: Content-Type: multipart/alternative;
2022-01-20 16:55:14 CLIENT -> SERVER: boundary=“b1_a2ItEW9nBzK7kPmJiRHED4WAXNzfbqK7NDjARitg1c”
2022-01-20 16:55:14 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2022-01-20 16:55:14 CLIENT -> SERVER:
2022-01-20 16:55:14 CLIENT -> SERVER: This is a multi-part message in MIME format.
2022-01-20 16:55:14 CLIENT -> SERVER:
2022-01-20 16:55:14 CLIENT -> SERVER: --b1_a2ItEW9nBzK7kPmJiRHED4WAXNzfbqK7NDjARitg1c
2022-01-20 16:55:14 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
2022-01-20 16:55:14 CLIENT -> SERVER:
2022-01-20 16:55:14 CLIENT -> SERVER: sdsdsdsdsd
2022-01-20 16:55:14 CLIENT -> SERVER:
2022-01-20 16:55:14 CLIENT -> SERVER: --b1_a2ItEW9nBzK7kPmJiRHED4WAXNzfbqK7NDjARitg1c
2022-01-20 16:55:14 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
2022-01-20 16:55:14 CLIENT -> SERVER:
2022-01-20 16:55:14 CLIENT -> SERVER: sdsdsdsdsd
2022-01-20 16:55:14 CLIENT -> SERVER:
2022-01-20 16:55:14 CLIENT -> SERVER:
2022-01-20 16:55:14 CLIENT -> SERVER: --b1_a2ItEW9nBzK7kPmJiRHED4WAXNzfbqK7NDjARitg1c–
2022-01-20 16:55:14 CLIENT -> SERVER:
2022-01-20 16:55:14 CLIENT -> SERVER: .
2022-01-20 16:55:15 SERVER -> CLIENT: 250 2.0.0 OK a2ItEW9nBzK7kPmJiRHED4WAXNzfbqK7NDjARitg1c@10.0.2.207 [Hostname=AM6PR0102MB3302.eurprd01.prod.exchangelabs.com ]
2022-01-20 16:55:15 CLIENT -> SERVER: QUIT
2022-01-20 16:55:15 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
2022-01-20 16:55:15 Connection: closed
and this too *
Thanks for your help its really appreciated
vfn
January 20, 2022, 5:10pm
19
Its working… i will describe what i have done and will post it here.
thanks for all your help, very much appreciated
vitor
1 Like
JR1
January 27, 2022, 4:13pm
20
what was the solution? you never reposted