Conecte o PHP ao SMTP distante em uma caixa vagrant


0

Eu preciso testar alguns formulários da minha máquina dev local usando vagrant. Mas o problema é que não consigo encontrar uma maneira de se conectar ao SMTP distante usando minha caixa vagrant. Quando no meu site "ao vivo", tudo funciona bem, mas não quero implantar toda vez que faço uma alteração.

Eu tentei muitas coisas, public_network com DHCP, "--nicpromisc2", "allow-all" ....

Eu não posso fazê-lo funcionar, existe algum Vagrant Guru lá fora para me ajudar com isso?

Obrigado !

Aqui está o meu Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

require 'yaml'

current_dir    = File.dirname(File.expand_path(__FILE__))
configs        = YAML.load_file("#{current_dir}/deploy/group_vars/all")
vagrant_config = configs


# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|

  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  if Vagrant.has_plugin?("vagrant-cachier")
    # Configure cached packages to be shared between instances of the same base box.
    config.cache.scope = :box
    config.cache.synced_folder_opts = {
      type: :nfs
    }
  end

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "ubuntu/trusty64"

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  config.vm.network "private_network", ip: "192.168.33.10"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  config.vm.synced_folder "./public_html/", "/var/www/html"
  config.vm.synced_folder "./tools", "/var/www/html/tools"

    config.hostmanager.enabled = true
    config.hostmanager.manage_host = true
    config.hostmanager.ignore_private_ip = false
    config.hostmanager.include_offline = true
    config.vm.define 'default' do |node|
      node.vm.hostname = vagrant_config['hostname']
      node.vm.network :private_network, ip: '192.168.33.10'
      node.hostmanager.aliases = [ 'www.' + vagrant_config['hostname'] ]
    end

    config.vm.provider :virtualbox do |vb|
         vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
         vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
    end


  # Enable provisioning with a shell script. Additional provisioners such as
  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  # documentation for more information about their specific syntax and use.
  config.vm.provision "ansible" do |ansible|

    ansible.playbook = "deploy/site.yml"
    # ansible.inventory_path = "deploy/inventory/development"
    ansible.limit = "default"
    ansible.groups = {
      "webservers" => ["default"],
      "dbservers" => ["default"]
    }
    ansible.sudo = true
    #ansible.verbose = "vvvvv"
  end
end

Você editou o arquivo hosts da caixa vagrant?
aleatório

Não, eu deveria?
Jonathan Lafleur

A caixa pode fazer ping em qualquer site?
aleatório

Sim, é quando eu tento telnet que ele não funciona e o PHPMailer falha em conectar
Jonathan Lafleur
Ao utilizar nosso site, você reconhece que leu e compreendeu nossa Política de Cookies e nossa Política de Privacidade.
Licensed under cc by-sa 3.0 with attribution required.