I'm setting up an app to preform mailhooks. You create an account, assign a callback url, and a pattern to match. Then you get a subdomain that you can send email to. Something like accountname.mail.appdomain.com.
This is how it might work.
Pattern: ^(?P\w+)-reply$
Account: accountname
Callback: http://www.someotherapp.com/reply/create/
If someone sends an email to 12345-reply#accountname.mail.appdomain.com I need to be able to collect that email in I guess a catch all mailbox. Then have a background job that fetches mail and routes them based on the TO address and custom domain.
The problem I am running into is how to get the email server to accept these incoming emails. Right now I have a MX record set up that points from *.mail.appdomain.com to mx1.emailsrvr.com and mx2. When I "dig" I get the correct routing however I don't think the email server is set up to accept the incoming mail.
If this is not possible another option I have been playing with is creating a python smtp server using the built-in smtp lib. All this server would do is accept incoming requests to port 25 and place the mail in a queue. I have that working fine I'm just worried that not using a real smtp server might create problems.
BTW: The main server will be running on slicehost, if that matters.
ALSO: This server is not going to be sending email from these custom domain, if that matters.
What you need is a dynamic configuration of your mail server, right? Then this depends on your mail server capabilities.
If you use Postfix then you could add virtual domain setup being configured in MySQL tables. Or other databases. From within your application you then only need to add/remove rows in these tables to accept only the valid domains.
Same goes for Exim which is even more extensible.
Related
I'm currently testing some complicated functionality in a web app that involves multiple accounts within the app; each with its own unique email address. I have a few temp gmail accounts that I'm using for this purpose, but keep having to update email addresses in the database to something else for some accounts in order to reuse email addresses. It gets meesy very quickly.
My question is; is there a way I can setup an email server on my VPS (Ubuntu 16.04) that is able to accept all email addresses on a given domain without me having to define each one in advance? Ie; I'd like to be able to make up email addresses as I go; test1#mydomain.com, test2#mydomain.com, etc, and have the server receive AND store any incoming emails to those addresses. Emails include account verifications, notifications, etc, and I need to know what is being sent to each participant at each point in each workflow as I test.
Ideally I'd like some way to view all of these emails on the domain regardless of address. Perhaps setting up an alias using some kind of wildcard so that all incoming email go to a single address that I can configure in my email client on my dev machine.
Consider rewriting envelope recipient x#subdomain.example.net to handler+x#example.net
AFAIR sendmail, postfix and exim support such rewrites. AFAIR all three support passing +detail as parameter to procmail script (to ~handler/.procmailrc as $1).
WARNING: test handling message to multiple special recipients.
Post which specific SMTP/MTA server do you use if you want more hints.
Gmail also supports plussed addresses BUT you get reliable hint about original recipient only for message to single special/plussed recipient.
After a lot of research and messing about with different configurations, I found the best solution for me was PostFix with Dovecot.
I was able to set up virtual mailboxes in PostFix with virtual_mailbox_maps pointing to a file that contained this; #mydomain.com mydomain.com/catchall/
This allows mail to any email address within the domain to go to one mailbox. The mydomain.com/catchall/ is a location on the server where the mailbox is located. By convention, the domain is used in the path. Useful if you are hosting email on multiple domains. Dovecot supports variables in the config which allows you to point it to the correct mailbox.
I also found that the PostFix main.cf file must have mydestination = localhost for this configuration to work.
the following posts helped me getting this up and running;
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-postfix-e-mail-server-with-dovecot
https://www.digitalocean.com/community/tutorials/how-to-install-and-setup-postfix-on-ubuntu-14-04
We have custom cms that currently sits on a vendor's subdomain, such as cms.vendor.com. It sends email out as coming from user#vendor.com and it seems to be working fine (using Email Queuing + SwiftMailer)
Our vendor asked us to put in the functionality for his users to be able to select from a dropdown, 3-4 other emails address associated with them from other domains he owns. Basically we need to be able to send out emails from our server labeled as being sent from #hisdomains.com, multiple domains.
I am a web programmer and have no clue when it comes to relaying messages. How would I go about being able to send out emails from his other domains? Does he need to setup permissions on his mail servers, or do I need to get into his SMTP servers to send out?
What are some things I should look out for when it comes to SPAM and gmail trusting us?
EDIT:
Not sure if my original question was clear enough. Vendor owns three domains: mysite.com, myothersite.com, mythirdsite.com. He wants a user from our crm to be able to send emails he has on those domains. So my dedicated server will be trying to send an email out as user#mysite.com, user#myothersite.com, and user#mythirdsite.com in the FROM: header.
As long as your server is allowed to send on behalf of a domain your vendor owns, you should not have a problem; just change the From: header to something else when you send out the e-mail.
Stuff like SPF, Sender ID and DKIM have to be properly configured to allow your server to send on behalf of any domain.
See also: http://en.wikipedia.org/wiki/E-mail_authentication
Any domain where the mx record resolves to the same server will work. so user#any.domain will email the same user on the mx contingent server.
To answer your question - just make sure that the mx records in the DNS zone file for each domain name points to the same server as the domain you want to share emails on.
also dependent on server configuration (like shared or whatever) I'm assuming it's dedicated with a simple email server installed. I'm not sure on cPanel/shared servers. but possibly the same.
Am developing and newsletter email software in vb.net for a friend, and he has asked me to add option to send email using dns servers,
How do i send an emai using dns server without smtp or imap?
Send email "using DNS servers" still uses SMTP. And it's generally a bad idea. Here's what it's about:
Usually, an email app (your own, Outlook, etc.) send mail using SMTP or similar protocol to a configured mail server. It could be a company's own server, or an ISP's server, or something like that. The mail may pass through various outgoing mail servers on its way out of an organisation, but at some point it hits a "boundary server" (There are pretty names for all these different types of server, but they're not important right now.)
This boundary server uses DNS to find the recipient's mail server and then sends the message (using SMTP) to that server. (I have omitted the details on purpose)
Sending email "using DNS" means that your app acts as a boundary server. It uses DNS to find the recipient's mail server and then sends the mail directly - rather than using any outgoing servers.
It's a bad idea for two reasons.
More and more ISPs block SMTP traffic that doesn't pass through their outgoing servers
More and more incoming servers validate the boundary server using various techniques. Your app is not likely to be accepted by these servers
Both of these issues are anti-spam countermeasures, so using this technique makes you look like a spammer, leaves many of your messages blocked, and is likely to get your IP address blacklisted.
Hopefully you can explain this to your friend so that they will understand that the "normal" way of sending mail is the only way to ensure that they don't get listed as a spammer.
Need to implement the email validation to find if the email really exists. After some search found that the this is not possible due to the spam control techniques used (e.g. grey listing).
So moved with MX and A attribute check (as we are not allowed to send confirmation mails directly):
DirContext ictx = new InitialDirContext();
Attributes attrs = ictx.getAttributes("gmail.com",
new String[] {"MX"});
I am getting the results but not sure how the dns lookup works here (the complete background of the request and response i.e how the request is forwarded to the mail exchange server and also which port is used for the contacting the Mail Exchange server)
This will immensely help in moving into the production env without any doubts about the network behavior as we are having strick firewall restrictions.
Production Env : Weblogic Server on Solaris OS.
Similar dicussion is at Email validation MX Lookup but it doesnt have enough detail
It sounds like you're confusing two different techniques:
1) Perform a DNS lookup to ensure that an MX record exists for the domain. This will eliminate all email addresses at fake (i.e., not registered) domains. Note however that having an MX record is not a requirement for legitimate mail reception. In the absence of an MX record, the mail software will simply use the A record for the base domain.
2) Make a TCP connection to the recipient mail server to see if anything is listening. This is always port 25. You don't have to send a test message, you can just connect to the port and then immediately disconnect. A successful connection implies a valid email address. (Or at least, a valid domain, which is as much as you can verify.)
I need a cross platform (at least windows and mac) development utility that runs as an SMTP server that acts as an SMTP server but will redirect all mail to a single address that's configurable. It would also be helpful if it wrote the contents out to a file or gui. Long ago I configured Apache James to do this but it wasn't that straight forward to figure out. Hoping there's something really simple out there.
I need the emails to be forwarded (to the single address) so I can see how they are rendered on different clients (gmail, outlook, etc.)
Thanks! -Mike
We used Mailtrap for this. It give you remote smtp server account and direct access to all mails in it. So you just enter given smtp credential in your application and after that all email sent by your system will be visible on mailtrap.
On mailtrap you can have as many smtp account as you want( different account for different application environments, or different application) Also you can manage access to your account ( so only trusted people will se your emails) and you can forward some emails to real email addresses.
It doesn't do the forwarding you are looking for, but for most of my testing I make use of fakemail (http://www.lastcraft.com/fakemail.php) it's simply a script that listens on a port an acts as an smtp server, writing any incoming mail to a directory.
You could use Python's smtpd library and override the process_message function to only send to the desired address -- i.e. replace the "to" field with your desired constant email address.
Here's a page with some examples of using smtpd (with asyncore) to actually send out mail.