php - How to send email from local machine to gmail? -


i learning php , it's first question on site. hope, me. want send email local machine gmail. have tried didn't got success. please how this. code form processing return mail( $message['to'], join("\n", $headers)) }; ?>

you want mail() function see: php.net/manual/en/function.mail.php

mail('kushagra@gmail.com', 'my first email', 'the body of email'); 

you need mail server running on local machine such postfix *nix or pegasus windows.

if not have ability run mail server on machine might need use php class allows connect smtp server such swiftmailer or phpmailer.

be aware though lot of isps block connections on port 25 (smtp) protect against spamming (see encounter of optus few years ago http://blog.simonholywell.com/post/374223466/optus-cable-port-25-smtp). if blocking need use smtp server.

there tool linked in blog post above allow determine if blocked or not see: http://www.zoneedit.com/smtp.html


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -