I am currently setting an email server that sends out an email using smtp, I've used smtpfaker to check whether the mail is actually being sent, but cannot see the content of the mail using that application is it somehow possible to read, just to be sure that the content is correct.
Related
Is there a way to ask for delivery receipt (Return-Receipt-To) using TIdMessage?
I have an application that sends emails via SMTP, I'm using TIdMessage but it seems like only read receipt is working (ReceiptRecipient property).
I'm aware that delivery receipt isn't supported by all email servers, but if the user already knows it works using their email client (for example, they see it works on MS Outlook) they want it to work with my SMTP email application too.
The TIdMessage.ReceiptRecipient property sets both Disposition-Notification-To (read receipt) and Return-Receipt-To (delivery receipt) email headers.
If you don't want Disposition-Notification-To set, then leave the TIdMessage.ReceiptRecipient property blank, and then use the TIdMessage.ExtraHeaders property to set just the Return-Receipt-To header.
Not sure if this is possible. We send emails in our Spring Boot application, using MessageHelper we set the FROM. However, when the email is received we see a different from in the mail client.
So I can understand why, but we were hoping it might be possible to show a different value.
We use Gmail as the sender and have a Gmail account that the emails get sent from, so it has an email address that we will call myaccount#gmail.com
We use that address in the
spring.mail.username=myaccount#gmail.com
In the code we set the From via either MimeMessage or MimeMessageHelper, but in the end they update the same MimeMessage instance.
messageHelper.setFrom("support#mycompany.com");
message.setFrom("support#mycompany.com");
If the message gets sent and looking at the recipients mail client it show in the From column "myaccount#gmail.com". But we want it to show support#mycompany.com
I know technically the email message is sent from the myaccount#gmail.com and in the headers it can show that, but for the UI we want to show support#mycompany.com
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.
I'm developing a web application that uses javamail to send email messages and it works correctly.
The problem is that I don't get the email that I'm sending in the sent mail folder in the gmail account which I connect to, also I don't get bounced email as it happens if I try to send the email via gmail application.
I doubt this is due to security restrictions from javamail and cannot be done, as it would be much faster to get a possible spam list from an email server than doing it manually.but if it's for security reasons it would just be much better just not to bounce emails.
How can I use javamail as if sending the mails from gmail.com, getting the sent message in the sent mail folder and bounced mails in inbox folder?
The problem is that I don't get the email that I'm sending in the sent mail folder
Sending a mail via SMTP does not copy it to a sent folder automatically. Your sending application would have to make an IMAP connection after the SMTP connection and copy the message into the sent folder.
also I don't get bounced email
Make sure the Evelope Sender Address ("Return-Path") is set to the Gmail Adress you're using to send the messages.
I have a web app that only registered users can use, therefore I should have a valid e-mail address for the creator of the message.
One part of this web app will allow a user to create and send a e-mail message to an e-mail address that the user enters. My web server will be creating and sending the e-mail, however if there is a delivery problem with the e-mail I would like the bounce to go to the user's e-mail address instead of the server. This will allow the user to know that there was a problem delivering the message and they can take the appropriate action.
Would setting the "return-path" attribute to the user's e-mail address handle this?
As RFC2821 says:
The primary purpose of the Return-path is to designate the address to which messages indicating non-delivery or other mail system failures are to be sent. For this to be unambiguous, exactly one return path SHOULD be present when the message is delivered.
So yes, all standard compliant servers should account for the Return-path you set.
You could set up windows service on your server to periodically check BadMail folder and parse the bounced messages and resend them to the original sender. This solution would work in most cases. I don't think return-path would help in every instance (if it would at all), because different mail servers handle bounces differently.