tags:

views:

36

answers:

3

I have used php mail function for sending mail to local mail id's and external mail id's. using this mail function I am able to send mail to my local mail id's but the mail function is not sending mail to external mail id's. like [email protected]

I have used the following methods to set the SMTP server address.

ini_set("SMTP","net4india.com");
ini_set("sendmail_from","[email protected]");

and I added with header also

$headers .= "SMTP-Hott: net4india.com";

but the mail is not going to gmail.

where I need to configure the SMTP server name in my program to send the mail to gmail,yahoo ,hotmail,etc.,?

+1  A: 

My first recommendation is to use PHPMailer to send email in PHP: http://phpmailer.worxware.com/

Aside from that, I know that google will check SPF DNS records to validate your from address. Here is a wizard that'll help you create an SPF record for your domain: http://old.openspf.org/wizard.html?mydomain=example.com

Mike Sherov
+1  A: 

I have found that using the Pear libraries: Net_SMTP, Mail that you can get better error messages and offers a wider range of options:

http://pear.php.net/package/Net_SMTP

http://pear.php.net/package/Mail

You may want to try using those libraries rather than the built in mail function for php: Demo on how to use Pear Mailer Class

Marco Ceppi
A: 

The MX record for csoft.co.in (64.187.109.136) is gw-mail7.myhsphere.biz (204.10.107.116). So net4india.com (202.71.130.4) would probably reject your e-mail since it doesn't know who you are. In these days of spam you cannot connect to a random mail server and have your e-mail delivered to someone else.

Whatever, net4india.com doesn't even seem to host a SMTP server at all.

To sum up: learn from whoever provides you with mail service for your "@csoft.co.in" account what the SMTP settings are. If you have to provide a password, you cannot use the built-in mail() function at all.

Álvaro G. Vicario