Flask-Mail - Any way to request Read Receipt? - email

I just spent a little time browsing similar questions on here, and it looks like some mail frameworks have a way of sending the proper signals to a mail client for the confirmation of read receipts.
The project on which I am working must have Read-Receipts requested as all the recipients have auto-sent read receipts enabled, and also have images blocked so I'm unable to use image-loading for tracking.
I'm most familiar with Python, Flask, and Flask-Mail, which is why I'm starting here to see if anyone knows a way to request this through these frameworks, or perhaps knows what to add to a to a mail header to request this.
Thanks!

So after a little more research and testing, in the absence of a specific setting in Flask-Mail for read-receipts, it is possible to request them by defining the header Disposition-Notification-To using extra_headers in the Flask-Mail Message() definition in order to trigger a read-receipt request:
sender = 'sender#domain.com'
recipient = 'recipient#anotherdomain.com'
msg = Message(subject='Testing Read Receipt',
recipients=[recipient],
sender = ('Testy McTesterson', sender),
extra_headers={'Disposition-Notification-To': sender})

Related

Mail stay in queue when i use Sendgrid in symfony6

I have set my Sendgrid single sender and validate it ( status = verified).
I use SMTP, create my key that i paste in my code (.env file of my app):
MAILER_DSN=sendgrid+smtp://#default
Then i try to test integration in Sendgrid by clicking on button and refresh my localhost/ page (of course the controller's route is "/" and it contains the code using mailer to send a mail as explain in mailer documentation).
On my vue i don't have error code but mail stay in queue status...
Here the screenshot taken of the profiler:
Can someone tell me why my mail stay queued?
Of course the From email address is mine ( the verified one) and the To is anotherone of mine.
Maybe i have to configure something in my outlook mail (the From one) ?
Sendgrid never match the verification, it stay in checking status until message :
Hmm, we haven't seen your email yet.
Please check your code, run it again, then click "Retry".
Thanks for reply,
Regards,
In your question you said that your MAILER_DSN environment variable is set to:
MAILER_DSN=sendgrid+smtp://#default
That is missing your API Key though. You need to create an API key in the SendGrid dashboard and then add the API key to the MAILER_DSN variable, between the // and the #default like this:
MAILER_DSN=sendgrid+smtp://API_KEY#default
One other thing, ensure that you have installed the SendGrid transport with this command:
composer require symfony/sendgrid-mailer
Yes, thanks you a lot for reply.
Of course all was set as you notify me.
I now have fix my issue, in fact the problem for me with the mail that remains in queued is that the messenger was installed so in asynchronous by default.
I had to add the option message_bus: false in my config/packages/mailer.yaml file not to have the asynchronous option used.
Hopefully this is useful for some people.
add the option message_bus: false in my config/packages/mailer.yaml:
framework:
mailer:
dsn: '%env(MAILER_DSN)%'
message_bus: false

Processing tokens through Drupal Rules

I am using the Rules module to respond to specific events and send email alerts. This part of my project works fine.
My problem is I need to include some dynamic data in the email message. For this I am using Tokens but the tokens do not get processed and replaced with the neccessary text. This means the email gets delivered with tokens in the message.
Can anyone suggest how I can solve this problem either programmatically or via some configuration I am missing?
I'm using Rules for emails also and hav not encountered any issues using tokens
This is an example of the body of the email from one of my rules
New Issue --> [node:url]
Title - [node:title]
Description - [node:body]
Author - [node:author]
Priority - [node:field-issue-priority]
Category - [node:field-issue-category]
Maybe you do not have the proper format?

email not proper in rails 3

I've same problem like here. But still not able to solve it.
I've followed steps from here. but doing so doesn't sends mail.
The log file says: Mail is sent. but at the other side mail is not received.
Any ideas why?
Check your SMTP settings and make sure you have defined the right settings for your e-mail host. If you are using a sender e-mail other than Gmail then your settings will be different to the ones used in the Railscast.
The file to check is here: config/initializers/setup_mail.rb.
Edit: It still may be possible that the settings you used in jsp may not match perfectly with the 'phrasing' that Rails expects in the setup_mail.rb file. I have frequently come up against this problem where a slight difference in what SMTP settings you mention / don't mention / how they are worded will determine whether the e-mails send/receive or not.
If your logs show the e-mail is sending to a valid e-mail address (and you are not receiving those e-mails in your inbox or spam filter) then the problem, as far as I know, is most likely to be your SMTP. My advice is to check online for the Rails-specific SMTP settings for your e-mail provider, or in the case that you cannot find them, try different combinations until you find the correct one.
Okay the problem is solved. Problem was my file corresponding to action was not at proper place. Here is quick view on how to do it:
Add following to actionmailer:-
def send_mail
attachments['1.pdf'] = File.read('c:/1.pdf')
mail(:to => "harsh#xyz.com", :subject => "xyz", :from=>"harsh#xyz.com")
mail.deliver
end
Notes:- Make sure that the smtp settings are correct and the file corresponding to the action (In this example send_mail.rhtml) is present under appropriate folder.

How to set up an email server that will accept a URL in the subject of an email and respond with a copy of that webpage

I'm trying to piece out how difficult it would be to set up an email server that will accept a URL as the subject of an email and respond with an attached copy of said webpage, or element(s) of that webpage (ie, an image from the page, or all of the videos on the page).
I don't necessarily need the code written for me, but would appreciate if someone could suggest a starting point.
I have very little web-programming knowledge (some C++, some Actionscript), which is partly why I don't even know where to begin.
There is several ways to achieve this.
In most unix MTAs you can set up an alias to pipe all messages for some address through a program.
This program need to parse the message header for the "from" and "subject", fetch the url and sent it back.
You can also do this with a program like fetchmail, so you dont even need to make something in the server side.
Finally, several languages have wonderful libraries fetch the mail using POP3, parse it, fetch the URL from the subject and compose a new mail message. Should be no more than 100 code lines with perl or python.

Embed indentifier within an Email

I am trying to embed an ID into an email so that when a recipient replies to an email that my system sends out, my system can pick it up and match the two together.
I have tried appending a custom header, however this is stripped out when the user replies.
I have tried embedding an HTML comment within the email, but outlook does not seem to keep comments when a reply email is created.
Worst case scenario, I can manually try and match the sent and received emails by time span or have a visible tag within the message body.
Does anyone know of a more elegant solution?
Thanks in advance
Email messages already contain such an identifiers, called Message-ID. And there's even a way to send which message you're replying to by sending that ID in a header called In-Reply-To. That's done by pretty much all email clients, that's how they usually do their threading.
It's defined in RFC 822 (yep that's pretty old) and probably re-defined and refined in more modern versions of that.
I have seen a method that includes a one byte image with a unique name that's linked to the user. When they view the email and download the images, your HTTP server will record a hit for that unique image. Of course the user needs to display images, but you can include a message in the body asking them to display the images. We actually include content in an image so they need to show images.
If your incoming e-mail can handle +foo or -foo suffixes, use that.
Many e-mail systems can route user+foo#example.com or user-foo#example.com
to user#example.com. You can replace foo with some kind of identifier.
Several mailing list servers use this for tracking bounces.
While I can't say for certain, my investigation in that sort of matter some time ago yielded the following "conclusion":
Headers are transformed a lot
Message bodies are transformed a lot
This is partly because, I suspect, of:
Need to protect users from malicious intentions
Need to perform "targeted marketing"
I have seen "unique codes" flying around in clear text in the email body but I would suggest having a unique identifier embedded in the return address instead.
The usual approach is to place the id in the subject line and/or somewhere visible in the message text and informing the recipient that he should not modify the subject or quote the original mail when responding.