0

i am trying to send a email using xampp. I have been in to php.ini and sendmail.ini But it does not work!. I tried to use this code.

    <?php $to = 'PixelatedPig9977@gmail.com'; $subject = 'Fake sendmail test'; $message = 'If we can read this, it means that our fake Sendmail setup works!'; $headers= 'From:willlun66@live.se'."\r\n" ; if(mail($to, $subject, $message, $headers)) { echo 'Email sent successfully!'; } else {  die('Failure: Email was not sent!'); } ?>

It says the the email was successfully sent but there is nothing at my email!

pixelatedore
  • 39
  • 1
  • 2
  • 6

2 Answers2

0

How did you try to send mail? is it from localhost ?

if from localhost you can send emails from XAMPP or WAMP (localhost) in PHP in Windows.

a) Open the "php.ini". For XAMPP,it is located in C:\XAMPP\php\php.ini. Find out if you are using WAMPP server.
Note : Make a backup of php.ini file

b) Search [mail function] in the php.ini file.

You can find like below.
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost

Change the localhost to the smtp server name of your ISP. No need to change the smtp_port. Leave it as 25.
Change sendmail_from from postmaster@localhost to your domain email address which will be used as from address..

So , it will become like this.
[mail function]
; For Win32 only.
SMTP = smtp.planetghost.com
smtp_port = 25
; For Win32 only.
sendmail_from = info@planetghost.com

c) Restart the XAMPP or WAMP(apache server) so that changes will start working.

d) Now try to send the mail using the mail() function .
gayan_ms
  • 141
  • 1
  • 1
  • 10
0

if your smtp email address is PixelatedPig9977@gmail.com which you are using to send email and receiving to the same email address PixelatedPig9977@gmail.com then your email could not be shown on the inbox, it should be in All Mail with From: me and it is already set as read

tzafar
  • 674
  • 3
  • 12