我需要從我的本地主機發送電子郵件。如何使用PHP從本地wamp服務器發送電子郵件?
我正在使用wamp服務器,我的網站已加載到我自己的服務器上,請問您可以建議如何使用我的本地主機和PHP發送電子郵件?
我需要從我的本地主機發送電子郵件。如何使用PHP從本地wamp服務器發送電子郵件?
我正在使用wamp服務器,我的網站已加載到我自己的服務器上,請問您可以建議如何使用我的本地主機和PHP發送電子郵件?
您可以在PHP中使用郵件功能。 http://php.net/manual/en/function.mail.php
如你自己收留了它,你必須用它來檢查你的互聯網服務提供商的SMTP和更新php.ini並應工作。
對於像WAMP這樣的東西,mail()函數通常不起作用。您需要將SMTP服務器的詳細信息添加到php.ini文件中。
這裏是一個很好的教程:http://roshanbh.com.np/2007/12/sending-e-mail-from-localhost-in-php-in-windows-environment.html
謝謝,但主要不能發送從我的ocalmail服務器..請儘可能提供fuull描述。 ..任何幫助都將被處理.......... m等待最後幾天 – pratik
在php.ini,設置以下參數:
打開你的p hp.ini並找到[郵件功能]部分
之後,您必須更改以下選項並與SMTP設置相關。
設置改變:
SMTP = ; Enter here the address of your SMTP server
smtp_port = 25
從你的PHP腳本
Finaly你必須使用郵件功能http://php.net/manual/en/function.mail.php
這裏的步驟來實現這一目標:
下載sendmail.zip通過這個link
打開sendmail.ini並設置配置如下:
smtp_server = smtp.gmail.com
主機=本地主機
訪問電子郵件帳戶。點擊齒輪工具>設置>轉發和POP/IMAP> IMAP訪問。點擊「啓用IMAP」,然後保存您的更改。
運行你的WAMP服務器。在Apache模塊下啓用ssl_module。
接下來,使PHP下php_openssl和php_sockets。
打開php.ini並將其配置爲以下代碼。基本上,你只需要設置sendmail_path。
[mail function] ; For Win32 only. ; http://php.net/smtp ;SMTP = ; http://php.net/smtp-port ;smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = [email protected] ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path sendmail_path = "C:\wamp\sendmail\sendmail.exe -t -i"
我希望這會爲你工作..
你可能需要的東西等配置的SMTP客戶端在背景中。也許sendmail或類似的東西... –
閱讀這個帖子http://roshanbh.com.np/2007/12/sending-e-mail-from-localhost-in-php-in-windows-environment.html – Gowri
possible [如何配置WAMP(localhost)使用Gmail發送電子郵件的副本?](http://stackoverflow.com/questions/600725/how-to-configure-wamp-localhost-to-send-email-using-gmail) – mario