whitebox
whitebox

Reputation: 21

xampp php send mail

I searched on stackoverflow and google to find how to setup xampp, mercury and php code to send mail with window server 2008 r2.

And with tutorial found out I can send mail by using Mail::factory with smtp.gmail.com, and also can send mail by using Mercury (File -> Send mail message) with my_email_address@my_domain_name.com registered in Mercury. So I try to send mail by using php code. But it is sill not working in my case.

Here are my configs:

C:/xampp/apache/php.ini

sendmail_path = "\xampp\sendmail\sendmail.exe -t -i"

sendmail.ini

smtp_server=my_domain_name.com
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=my_email_address@my_domain_name.com
auth_password=my_password
force_sender=my_email_address@my_domain_name.com
hostname=my_domain_name.com

code php

$to = $email;
$subject = "Hello";
$message = "How are you ?";
$from = "my_email_address@my_domain_name.com";
$headers = "From:" . $from;
$result = mail($to,$subject,$message,$headers);

if($result){
    echo "Mail Sent." . $result;
}
else{
    echo "Failure." . $result;
}

I check in C:\xampp\sendmail\debug.log and get error

--- MESSAGE END ---
12/12/31 06:46:04 ** Connecting to my_domain_name.com:25
12/12/31 06:46:06 ** Disconnected.
12/12/31 06:46:06 ** Disconnected.
12/12/31 06:46:06 ** Disconnected.
12/12/31 06:46:06 ** Socket Error # 10061<EOL>Connection refused.

where am I wrong ? Would you please here help me ?

Upvotes: 1

Views: 10093

Answers (2)

Mudaser Ali
Mudaser Ali

Reputation: 4309

Please follow instructions as mentioned in following link:-

http://system66.blogspot.com/2010/01/how-to-send-mail-from-localhost-with.html

Upvotes: 0

GreenRover
GreenRover

Reputation: 1516

Most time is the problem the ip of the server. Because most provider dont allow traffic from dynamic ips, from servers with no god spf record ...

A solution would be, make a gmail account, and forward all traffic over gmail or an house internal exchange server. XAMPP Sendmail using Gmail account

Upvotes: 3

Related Questions