0

I need someone to help me: I'm trying to use PHP mail() function but it's not working. I'm using Windows Server 2008 R2 (I'm really newbie at servers) with IIS 7. This is how I've configurated SMTP (Port 25 is opened):

Deliver e-mailto SMTP server:
    SMTP server:
    smtp.1and1.es
    Port: 25
    Authentication settings:
    Not required.

I've configurated php.ini that way:

[mail function] 
;For Win32 only. 
SMTP = smtp.1and1.es 
smtp_port = 25 
;For Win32 only. 
sendmail_from = formphp@mydomain.com 

my code is this:

$name = $_POST['name']; 
$email = $_POST['email']; 
$subject = $_POST['subject']; 
$message = $_POST['message']; 
$to = 'contact@mydomain.com'; 

if (mail($to, $subject, utf8_decode($message))){ 
    echo "Sent"; 
} else { 
    echo "Error"; 
};

I always get 'Error'...Is there something I am missing??
I would appreciate any help. Thanxs so much.

AnFi
  • 10,493
  • 3
  • 23
  • 47
Carl
  • 111
  • 1
  • 12

2 Answers2

0

Use this standard php mailer class . Will help you lot.
And easily can configured with any of your domain.
https://github.com/PHPMailer/PHPMailer

  • I'm always getting Message could not be sent.Mailer Error: Could not instantiate mail function. – Carl Jul 17 '13 at 08:43
0

You have Authentication settings:Not required. But, doesn't smtp.1and1.es require authentication?

mti2935
  • 11,465
  • 3
  • 29
  • 33