How to track failover email notification? - email

I am sending email from application. My problem is when your type email address means format is correct but it may be not available anywhere.so when I am trying send such email address using SMTP through application, so how to track fail-over notification if intended recipient not found.
please suggest any approach.

There is no standard way of doing this. You might be able to make it work in some cases by parsing incoming email looking for delivery failure notices but it'll be a lot of work to keep that parsing code up to date. So at best you'll only get some of the notices. If you get a notice at all. The recipient's SMTP server may not send you anything, or the notice might get lost on it's way back to you.
The only way you are reliably get this sort of information is to host the SMTP server yourself, and deliver directly to the recipients SMTP server. In that case the SMTP server knows the status of the email's delivery and could report that to your email client via some non-standard back channel.
Note: Hosting your own SMTP server is non-trivial. And you will probably need to be on a fixed IP otherwise external SMTP servers will treat your email as spam. In case you're thinking of running one over a home connection or something.

Related

How to make sure that the email was sent in yii2?

In my project when the user stored a new record to database, sent to him email with to perform afterSave() Method.
How to make sure that the email was sent?
I don't think this is something to do with yii2 or the afterSave() event (as long as the afterSave event is triggered, which you can verify by Runtime Logging for example). When using PHPMailer class you can see this discussion about making sure an email has been sent.
$mail->send() will not always return true. It returns true if the part of the sending process it was involved with works. So if you send to an unknown address, but do so via gmail, gmail's servers don't know whether the address exists or not at the time, so it will be accepted and bounced later. If you were sending to a gmail address when sending through gmail, then it would fail immediately.
If an account does not exist at all, most servers (including gmail) will still give a 5.1.1 "Unknown user" response, and that will be reported correctly by PHPMailer if you send by SMTP directly to the recipient's supposed mail server (but not if you send via an intermediate server (like gmail) or using mail()). PHPMailer doesn't have built-in support for doing that, but doing it yourself only involves a call to getmxrr and setting Host manually. Also you won't need to use authentication if you send that way.
You can do various things like check if a domain exists at all - if it doesn't, mail delivery won't work. Some servers will accept all addresses and send bounces later (e.g. if they have a spam filter with a long processing queue), but if you get rejected up-front, it's a pretty sure indication that the address doesn't exist.
You need to look into bounce handling too which will allow you to remove addresses that looked ok but later proved not to be, which is an entirely separate thing from anything that PHPMailer does. I will warn you now - bounce handling is extremely unpleasant!
You should also send using tls on port 587, not ssl on 465; see the gmail example provided with PHPMailer.
I would also recommend you to send mails via an SMTP auth connection trough PHPMailer.

Analog of HTTP Redirect for SMTP

In HTTP, you can tell the client who asks for example.com/foo/ that it should ask for something.else/instead.
Is there a way to do it in SMTP? That is, if the client sends a message to john#example.com, tell it to send it to jane#somewhere.else instead.
I know that I can receive the message and relay it to jane#somewhere.else. For many reasons I don't want to relay messages via my server. Instead, I want to tell the client that it should send it to another address.
The reasons include:
I cannot notify the client of a failure (well, perhaps this can be done).
My server will be blacklisted if the message was spam.
The destination server will consult blacklists with my IP and not with the original sender's IP, etc.
My motivation is:
If this were possible, perhaps it would be a better antispam measure than greylisting.
My institutional server has no antispam filters, while my personal server uses IP-based blacklists such as Spamcop. After the institutional server has received a message, I can scan the message at the client but it's too late to consult Spamcomp and to inform the sender that the message was filtered out (I consider it a must in any filtering). I wish the institutional server could simply redirect people to my personal server, which is a lot better protected and correctly informs the sender of the problem at the SMTP stage.
Sendmail provides FEATURE(redirect) to handle such cases.
It rejects recipient in reply to RCPT TO: with
551 5.1.1 User has moved; please try <newemail#example.com>
Your email server refuses to accept the recipient with hint, it is up to sending host to generate bounce message to the sender. Spammers may/will get the new email too. I do not know any email servers handling automatically such redirects.
I have not investigated how well it is handled by various email clients and level of details provided in bounce message by various email servers.

Why my own mail server can not deliver mail to gmail, hotmail etc.....?

I am trying to build a mail server using Ubuntu to send mail
I have done some research on that and find it is nearly impossible for a individual to send
the mail e.g. hotmail , gmail.
The question i am asking is not how to build a own server, it is why i can not build my own server.
To be precise:
Questions:
1) what are the requirements to send to those e.g. hotmail ,gmail server ? e.g. mx record , clear dns record . (only from server aspect , not concerning other factors such as headers or mail content), It would be easier to understand if they are listed out.
2) I read some document and it said the problem can be overcome by relayhost, what is it about and is it feasible?
3) For those ISP , what are their procedure in building the mail server? How is it different from my own small Ubuntu one?
Sorry for asking a lot of question, any help would be nice and well appreciated .
Most people use an out-of-the-box package as a mail server, rather than trying to write one that follows all of the relevant RFC specifications for SMTP, Internet Message Format, IMAP4, POP3, etc.
I'm not saying "don't write your own", just that if you do, be prepared for months and months of hard work, lots of bugs and even more frustration. It's a big project.
In terms of sending messages, you will need to follow the Simple Mail Transfer Protocol (SMTP) to send messages; and they should be sent to the correct server, as per the recipient's DNS records - see RFC 1034 and RFC 1035.
If you are correctly using SMTP to send valid messages to the right server, there's not a lot else you can do.
Your next problem is going to be reputation. This would be the same, whichever software you use to send your messages.
It's easy for a spammer to set up a new mail server and start sending messages, so it will take a while for some mail servers to trust you (particularly those that are regularly targeted, such as Hotmail, Gmail, etc).
Instead of sending messages directly to the recipient's server, you can use SMTP to send the messages to a relay server. This would usually be your own ISP's server, but it can be any willing partner. You would normally need to make advance arrangements, so that they will permit you to relay messages.
The relay server would then attempt to send the message to the recipient server. If it cannot do so, it must report the failure to the sender.

Catch email bounce

I will be sending legitimate emails to a list of recipients and some of them are probably obsolete by now.
I wish to know, based on the email bounces, which are obsolete and delete them from the database. Except VERP I haven't seen anything standardized for this task.
Is there some other way that you know about?
There is no other way than VERP. DSN mails are good to extract the precise reason of bouncing, but not all servers send standard DSN mails. In addition to that, DSN mails can be forged which may be an issue. You can add a simple digital signature to a VERP address.
There is absolutely a way to do this. I run the engineering team at Kickbox. Our product takes a list of emails and will tell you which are valid and which are not (without sending to them). We have an API too.
You want to avoid bounces by sending to bad emails. Send to too many and your IP address will be globally blacklisted.
You can technically verify emails yourself through regular SMTP (just stop the SMTP commands before actually sending the email), but there are plenty of weird SMTP edge cases and for any serious number of emails you'll want to do this through a proper email network (like ours :-).
Hope that helps

Is there a reliable way to send email without having the senders smtp?

My application will be used in a manner that the user is remote from his computer running the application, receiving data via text messages sent periodically from the PC. Im sending the text message via email, using the number#carrierdomain.com. To simplify determining the user's smtp server, I've been sending the message using the destination phone carrier's smtp, instead of the whatever may or may not be available at the PC. This has worked so far with AT&T and T-Mobile, but not Verizon, as they have discontinued their smtp service.
I'm using mailsend v1.15 http://www.muquit.com/muquit/software/mailsend/mailsend.html
but Im open to alternatives.
I do have a less than ideal workaround, which is to use google or hotmail's smtp, but that requires a login/pass.
If I can send the text through regular email, using outlook, it works. I've looked at outlooks smtp logs, but that doesn't really help.
If its not being sent to a Verizon smtp server, how does it get routed, and is it something that my application can use?
Is there a reliable way to send email without having the senders smtp?
Theoretically, any smtp server can send your e-mail. However, due to the overwhelming amount of spaming on the internet, pretty much every isp has locked down their smtp server and will not allow anonymous relaying of e-mail.
If you do have the outlook client on the box you are sending the e-mail you can look at using one of the Outlook APIs:
http://msdn.microsoft.com/en-us/library/gg608200.aspx
to send the e-mail message. You are using the outlook configuration then and don't have to worry about it your code.
As long as an SMTP server is configured to allow relay from a remote domain then you can use it send email from/to virtually any address. There are downsides, however, to using any SMTP server to send an email from a specific domain - the most notable of which is that the recipient's domain will likely flag the message as spam because the domain of the SMTP server is different from that of the sender's email address.
There are other non-email APIs that can be used to send text messages, if that is something you're willing to consider. Check out:
Tropo (http://www.tropo.com)
Zeep Mobile (http://www.zeepmobile.com)
Best of luck to you.
Impossible. SMTP is the Simple Mail Transfer Protocol, without this is impossible to access to another account with Email format. You can make a php mail where you don't need to have smtp, but your access will be limited, not all ESP / ISP will allow you to delivery those emails, because they need to identify you using your SMTP and MX Lookup (Reverse MX A records) from your server. It exists more ways, but are 100% SPAMMERS and HACKERS methods and I don't recommend to use them.