Skip to content
This repository has been archived by the owner. It is now read-only.

setDomainName issue #7

Open
outflux3 opened this issue Jun 26, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@outflux3
Copy link

commented Jun 26, 2016

Setting the domain name doesn't override something in the headers, mailgun still registers the sender as the domain that is entered in the module settings.

The only way i've been able to get the messages to register in the correct log is to change that domain in the module settings; otherwise if there is a mismatch, then it somehow sets the envelope sender as postmaster@ the domain entered;

i spent some time trying to figure this out, but have hit a dead end; When I print_r the wiremail instance, it does show the override for the domain, but then when i see the message in the mailgun log, it still has that envelope sender as the wrong domain. I tried adding a header like this:

$mail->header('Sender', $identity->email);

but that didn't work;

Also i noticed that the fromEmail would be blank and thought that might fix this so i added the method..

    /**
     * Overrides the fromEmail setting in config
     *
     * @param string $fromEmail
     */
    public function setFromEmail($fromEmail)
    {
        $this->fromEmail = $fromEmail;
    }

but that may be superfluous since this is not affecting the envelope sender.

i think the problem may be that this:
CURLOPT_URL => "{$this->apiUrl}{$this->domain}/messages",

$this->domain is not being overridden by the instance

@outflux3

This comment has been minimized.

Copy link
Author

commented Jun 26, 2016

This was the only way i could figure this out;

basically means that i don't need to override the domain using that method (since it doesn't' work), but need to change the code to make sure the mail from is always set.

private function getDomainName() {
    return substr(strrchr($this->mail['from'], "@"), 1);
}

and then up in the ___send()

$dname = $this->getDomainName();

$options = array(
    CURLOPT_USERPWD => "api:{$this->apiKey}",
    //CURLOPT_URL => "{$this->apiUrl}{$this->domain}/messages",
    CURLOPT_URL => "{$this->apiUrl}{$dname}/messages",

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.