zoukankan      html  css  js  c++  java
  • PHP mac localhost 环境下发送邮件

    转载自:http://mabblog.com/blog/2011/09/lion-smtp-postfix-relay-and-dreamhost/

    When developing web-apps locally it is useful to have a fully functional smtp server to test automated emails associated with your application. Many times the network you are developing on will not allow you to simply start up postfix and and run your own local smtp server. However, this doesn’t imply that you can’t use postfix – modifying postfix to relay all outgoing mail to an external / offsite smtp server that you have control of will enable you to develop & test the parts of your application that require a local outgoing smtp server without an issue.

    Many times port 25 (the default smtp port) will be blocked somewhere along the line in your network connection. You can figure out if your network configuration or ISP is blocking port 25 by running

    telnet smtp.server.com 25.

    Edit /etc/postfix/main.cf

    relayhost = [mail.domain.com]:587
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options = noanonymous
    smtp_use_tls = yes

    Create/edit /etc/postfix/sasl_passwd

    [mail.domain.com]:587 username@domain.com:password

    Run this command in your shell once the above two files are created/modified:

    sudo chmod 600 /etc/postfix/sasl_passwd
    sudo postmap /etc/postfix/sasl_passwd
    sudo launchctl stop org.postfix.master
    sudo launchctl start org.postfix.master

    # test postfix, cmd+d after typing message content to send message
    mail -s "Testing, Testing" you@domain.com
  • 相关阅读:
    6个变态的C语言Hello World程序
    Thread和Runnable差别
    HTML5游戏开发技术基础整理
    Kruskal算法
    PHP手机获取6为不反复验证码
    怎样推断手机用户是移动,电信,联通?
    SQL Server 2012 sa 用户登录 18456 错误
    Phonegap(Cordova)3.4 + Android 环境搭建
    LCA在线算法ST算法
    Swift学习笔记八:枚举
  • 原文地址:https://www.cnblogs.com/zsw-1993/p/4879304.html
Copyright © 2011-2022 走看看