Jump to content

configure localhost to send mail


birbal
 Share

Recommended Posts

i am using xampp in windows. how can i setup the mail server to send mail from localhost? i looked for sendmail and mercury directory for set up. though did not get which one to set. i ran a test script to send mail to a gmail acount thoguh mail() is returning true but i am not recieveing any email to that acount even in spam folder.thank you

Edited by birbal
Link to comment
Share on other sites

Verify that your ISP allows traffic on those ports. If you can open a telnet session and connect to a mail server which you know is running on port 25 ("telnet smtp.gmail.com 25"), then you'll be able to send mail. If your ISP is blocking port 25 then you won't be able to send mail directly from your machine.

Link to comment
Share on other sites

i am not much familiar with telnet. i opened telnet and connect ("o")it in smtp.gmail.com 25 and its showing connection failed could not connect to the host. is that you are refering?is there any other way to send the email through localhost?

Edited by birbal
Link to comment
Share on other sites

You need port 25 to be open in order for your local mail server to deliver the message. If port 25 is not open, then no, there is not another way for your server to communicate with other SMTP servers which expect traffic on port 25. You would only be able to send to servers that are set up to use a non-standard port which your ISP is not blocking.If you're on Windows, the way I test is to open a command prompt and type the command I showed before.

Link to comment
Share on other sites

If you're on Windows, the way I test is to open a command prompt and type the command I showed before.
it is not connecting seems its blocked.i am having problem to get this network stuff (port,socket...).
You would only be able to send to servers that are set up to use a non-standard port which your ISP is not blocking.
i have heared that godaddy email a/c recievs mail from localhost in this type of scenerio. is that the reason that godady can listen to port other than 25? where as gmail only bound to listen from port 25? correct me please.another question is coming in my mind that
fsockopen('smtp.gmail.com',25,$errno,$errmsg);echo "$errno=$errmsg";

can it do the same job as you refering in telnet to check it is connecting or not?

Edited by birbal
Link to comment
Share on other sites

is that the reason that godady can listen to port other than 25?
When you set up a mail server, or any other type of server, you can set it up to listen on any port you want. But the SMTP spec says that port 25 is for outgoing email, so if a mail server is not listening on port 25 then it won't be able to receive email from any source that follows the SMTP spec. And yes, opening a socket on port 25 will basically test the same thing, it will test if the server can reach another machine on that port.
Link to comment
Share on other sites

so if a mail server is not listening on port 25 then it won't be able to receive email from any source that follows the SMTP spec.
here source is my localhost server. in my php.ini smtp port is 25. so if i change it to any port that can a remote smtp server is set up to listen ..then it can recive the emails (assuming it is not blocked by the ISP)? correct me here too please.and if any remote server is not maintaining the SMTP spec and set up to listen from other ports. how can anyone determine what port it is using? Edited by birbal
Link to comment
Share on other sites

here source is my localhost server. in my php.ini smtp port is 25. so if i change it to any port that can a remote smtp server is set up to listen ..then it can recive the emails
You're talking about an open relay. If you can configure PHP to not use localhost as the mail server, but use an open relay somewhere else which accepts connections on other ports, then you can use that mail server to send mail to others. I doubt you're going to find a free open relay though, those are generally blocked so spammers don't use them. You may be able to find a service which operates mail servers that you can use for that purpose. Your ISP itself probably operates a server like that, you may want to contact your ISP and tell them that you want to send mail from your local machine and ask them which mail server to use. They can control that since they can determine whether or not your IP is one of their customers when you connect to their server.
and if any remote server is not maintaining the SMTP spec and set up to listen from other ports. how can anyone determine what port it is using?
It needs to be published. Ask whoever set up the server.
Link to comment
Share on other sites

If you can configure PHP to not use localhost as the mail server, but use an open relay somewhere else which accepts connections on other ports,
what is open relay? i did not get it. is that sendmail used for?
Link to comment
Share on other sites

i read that. there in one place i found that now (e)smtp can also be connected in port 587. i tried that in telnet and its returning 220 success. in smtp.gmail.comanother place i saw about smtp authentication..where user will be authenticated to serve a email. i saw a setttings in sendmail.ini where i have to set the email a/c password. i guess its for that for preventing tthe open relay. is that the place i need to set up?i am trying to unsersatnd the network concept. though not sure i am on right path or not.

Edited by birbal
Link to comment
Share on other sites

Port 587 is generally for secure SMTP. Some server are set up to require authentication, and others aren't.
so when its now connecting me in port 587 it is authenticating me. is not it?...so changing the SMTP port to 587 to connect in port 587 in php.ini will make any sense?
you may want to look into the PEAR Mail package instead.
i did not work with any pear package or extra libary till now. how can i use that? i found there is a folder in php/PEAR called mail. but not sure how to use that.
Link to comment
Share on other sites

so when its now connecting me in port 587 it is authenticating me. is not it?
It depends if the server requires authentication. 587 is to port 25 what HTTPS is to HTTP, it's just secure communication. It doesn't necessarily require authentication.The documentation for the Mail package is here:http://pear.php.net/manual/en/package.mail.mail.intro.phpYou need to include the Mail.php file, which includes several other PEAR files. The path to PEAR should be in PHP's include path so that you don't need to specify the folder, only the filename.
Link to comment
Share on other sites

just tried to include the mail.php and i am returning this. what to do now?Deprecated: Assigning the return value of new by reference is deprecated

Edited by birbal
Link to comment
Share on other sites

i did not started anything yet. i mean i did not started creating objects in that page.the page has only require_once('mail.php');i wanted to see its realy incluing it correctly or not

Link to comment
Share on other sites

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Mail.php on line 154this is the error actually ocuring its pointing to the pear package. i am not sure what to do

Edited by birbal
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...