Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAIL_URL does not work on *.meteor.com as described in the documentation #1649

Closed
landland opened this issue Dec 3, 2013 · 2 comments
Closed

Comments

@landland
Copy link

@landland landland commented Dec 3, 2013

The documentation here states that the default Mailgun MAIL_URL may be overridden by setting process.env.MAIL_URL, however this does not appear to be the case. The documentation states:

For apps deployed with meteor deploy, MAIL_URL defaults to an account (provided by Mailgun) which allows apps to send up to 200 emails per day; you may override this default by assigning to process.env.MAIL_URL before your first call to Email.send.

However, Mailgun is always used despite the process.env.MAIL_URL setting. To reproduce:

  1. create new meteor app

  2. add below js code

  3. modify code to specific smtp provider (such as from Mandrill) and appropriate from and to email addresses

  4. deploy to a *.meteor.com domain using meteor deploy

  5. visit the domain and click the button

  6. verify that email is from Mailgun and not the smtp provider specified in process.env.MAIL_URL

    if (Meteor.isClient) {
      Template.hello.greeting = function () {
        return "Welcome to testmail.";
      };
      Template.hello.events({
        'click input' : function () {    
          Meteor.call('sendEmail',
                'xxx@gmail.com',
                'xxx@domain.com',
                'Hello from Meteor!',
                'This is a test of Email.send.');           
        }
      });
    }
    
    if (Meteor.isServer) {
    Meteor.methods({
      sendEmail: function (to, from, subject, text) {
        check([to, from, subject, text], [String]);
        this.unblock();
        Email.send({
          to: to,
          from: from,
          subject: subject,
          text: text
        });
      }
    });
      Meteor.startup(function () {    
        process.env.MAIL_URL = 'smtp://user:password@smtp.mandrillapp.com:587/';          
     });
    }

If this behavior is intended, then please update documentation to reflect this.

See Stack Overflow thread http://stackoverflow.com/questions/20337309/meteor-deploy-mail-url-not-being-set for more details

@landland
Copy link
Author

@landland landland commented Dec 3, 2013

Ah, looks like Tarangp reported this earlier today here #1647

@landland landland closed this Dec 3, 2013
glasser added a commit that referenced this issue Dec 3, 2013
Also:
- ensure that AppConfig callbacks are always called at least once
- don't start a new AppConfig Fiber every time you call Email.send

Fixes #1649.
@glasser glasser reopened this Dec 3, 2013
@glasser
Copy link
Member

@glasser glasser commented Dec 3, 2013

Thanks. I'm taking a different approach to @Tarangp that fixes some related issues, so I'll keep this one open and close the PR.

@glasser glasser closed this in 6582a88 Dec 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants