Sending email
Posted by: NourOm (89.246.252.---)
Date: July 06, 2017 09:32AM

Hello all,

I'm using WAMP server 3.0.6 (64bit). I was trying to send email from my php code but it's not working. I don't get any error message but the code is not sending any email.

I have done the following steps:

1- I have downloaded Sendmail.zip extracted it and put it in the root folder of WAMP.
2- Editing sendmail/sendmail.ini file
"
[sendmail]

smtp_server=smtp.gmail.com

smtp_port=465

smtp_ssl=ssl

;default_domain=localhost

error_logfile=error.log

;debug_logfile=debug.log

auth_username=myemail@gmail.com
auth_password= mypass

pop3_server=
pop3_username=
pop3_password=

force_sender= myemail@gmail.com

force_recipient=

hostname=localhost"

3- Edit php.ini in the php directory:
([mail function]

; For Win32 only.
; [php.net]
SMTP =
; [php.net]
smtp_port =

; For Win32 only.
; [php.net]
sendmail_from = myemail@gmail.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i" ).
; [php.net]
sendmail_path = "C:\wamp64\sendmail\sendmail.exe -t -i" )

4- I also found out that i have to edit php.ini in the Apache folder, but i don't have this file there. There is only a php.ini but as a (.symlink) it's like a shortcut and i can't open it or edit it.

after this i created a test code in php to send email:

$to = "otheremail@test.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: myemail@gmail.com";

if(mail($to,$subject,$txt,$headers))
print "success";

But I didn't get a result.
Can you please help me?

Options: ReplyQuote
Re: Sending email
Posted by: RiggsFolly (Moderator)
Date: July 06, 2017 09:58AM

To edit php.ini use the menus

wampmanager->php->php.ini

---------------------------------------------------------------------------------------------
(Windows 7 Pro 32bit) (Wampserver 3.0.6 32bit)
<Apache 2.4.23/2.2.31> <PHP 7.1.2/7.0.16/5.6.28/5.5.38/5.4.45/5.3.29> <MySQL 5.7.10/5.6.17/5.5.28>
<MariaDB 10.1.21> <phpMyAdmin4.7.5> <MySQL Workbench 6.3.6.511>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin -- WAMPServer alternate Repo
-?-?-?- Backup your MySQL databases regularly Here is How dont regret it later! Yes even when developing -?-?-?-

Options: ReplyQuote
Re: Sending email
Posted by: NourOm (89.246.252.---)
Date: July 06, 2017 10:22AM

I did like this, but a lot of other sorces made me confused that i have to edit other php.ini file in the apache folder. Anyway my code is not working till now and i have no idea why

Options: ReplyQuote
Re: Sending email
Posted by: RiggsFolly (Moderator)
Date: July 06, 2017 10:59AM

If you use the menu as suggested, that will edit the Correct `php.ini` file that is used by PHP when running under Apache.

The \wamp\bin\php\php{version}\php.ini file is only used by the PHP CLI and not PHP when running with Apache.

Maybe you shoudl find out what a Symbolic link is in windows Its a lot link a SYMLINK in unix

---------------------------------------------------------------------------------------------
(Windows 7 Pro 32bit) (Wampserver 3.0.6 32bit)
<Apache 2.4.23/2.2.31> <PHP 7.1.2/7.0.16/5.6.28/5.5.38/5.4.45/5.3.29> <MySQL 5.7.10/5.6.17/5.5.28>
<MariaDB 10.1.21> <phpMyAdmin4.7.5> <MySQL Workbench 6.3.6.511>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin -- WAMPServer alternate Repo
-?-?-?- Backup your MySQL databases regularly Here is How dont regret it later! Yes even when developing -?-?-?-

Options: ReplyQuote
Re: Sending email
Posted by: NourOm (89.246.252.---)
Date: July 06, 2017 11:36AM

I already did. I edited the php.ini file that you can reach with the menues. but the code is not sending email!

Options: ReplyQuote
Re: Sending email
Posted by: RiggsFolly (Moderator)
Date: July 06, 2017 11:56AM

Then there is not much we can do. We dont support SendMail, and I dont use it. Sorry.

---------------------------------------------------------------------------------------------
(Windows 7 Pro 32bit) (Wampserver 3.0.6 32bit)
<Apache 2.4.23/2.2.31> <PHP 7.1.2/7.0.16/5.6.28/5.5.38/5.4.45/5.3.29> <MySQL 5.7.10/5.6.17/5.5.28>
<MariaDB 10.1.21> <phpMyAdmin4.7.5> <MySQL Workbench 6.3.6.511>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin -- WAMPServer alternate Repo
-?-?-?- Backup your MySQL databases regularly Here is How dont regret it later! Yes even when developing -?-?-?-

Options: ReplyQuote


Sorry, only registered users may post in this forum.