Email Not sending - hellllpppp

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

As usual for problems like this:

done it, but dont tell me much!!

Well, please provide the exact error message you see.

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

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.

Not sure if this is even the problem but have you tried ticking Use SSL ?

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

  1. {code: 2, file: “C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php”, line: 1574,…}

  2. code: 2

  3. file: “C:\wamp64\www\wappler\dmxConnectLib\PHPMailer\PHPMailer\PHPMailer.php”

  4. line: 1574

  5. message: “Message body empty”

  6. 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}”

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

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!!

The error says the message body is empty. Are you sure you are not sending an empty mail?

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}”}

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.

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}”}

Doesn’t seem like a problem with the mailer script. Please see:

and

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.

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.
; http://php.net/smtp
SMTP = smtp.office365.com
; http://php.net/smtp-port
smtp_port = 587

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from ="support@mydomain.com"

; For Unix only. You may supply arguments as well (default: “sendmail -t -i”).
; http://php.net/sendmail-path
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

i have change the server name with
tls://smtp.office365.com

set_1_image3
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

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

what was the solution? you never reposted