question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mailgun - Issue when trying to add additional parameters

See original GitHub issue

📣 Notification Service(s) Impacted Mailgun

🐞 Describe the bug Regarding the apprise wiki, I’ve tried to add a “From” parameter to my mail but always got errors. Several trials :

  • mailgun://postmaster@{sandboxid.mailgun.org}/{apikey}/mymail@gmail.com will work Mailgun log :

{ “tags”: null, “timestamp”: 1666430709.990572, “storage”: { “url”: “https://storage-us-west1.api.mailgun.net/v3/domains/sandboxid.mailgun.org/messages/xxx==”, “region”: “us-west1”, “key”: “xxx==”, “env”: “production” }, “envelope”: { “sender”: “postmaster@sandboxid.mailgun.org”, “transport”: “smtp”, “targets”: “mymail@gmail.com” }, “recipient-domain”: “gmail.com”, “event”: “accepted”, “method”: “HTTP”, “user-variables”: {}, “flags”: { “is-authenticated”: true, “is-test-mode”: false }, “log-level”: “info”, “originating-ip”: “myip”, “message”: { “headers”: { “to”: “mymail@gmail.com”, “message-id”: “xxx@sandboxid.mailgun.org”, “from”: “postmaster@sandboxid.mailgun.org”, “subject”: “ChangeDetection Notification - Change Detection” }, “size”: 604 }, “recipient”: “mymail@gmail.com”, “id”: “xxx” }

  • mailgun://postmaster@{sandboxid.mailgun.org}/{apikey}/?From=Luke%20Skywalker/mymail@gmail.com (using the same exact example as the wiki) will not work Mailgun log :

{ “tags”: null, “timestamp”: 1666430944.9932263, “storage”: {}, “event”: “rejected”, “campaigns”: null, “flags”: { “is-authenticated”: true }, “reject”: { “reason”: “Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings.”, “description”: “” }, “message”: { “headers”: { “to”: “postmaster@sandboxid.mailgun.org”, “message-id”: “xxx@sandboxid.mailgun.org”, “from”: “postmaster@sandboxid.mailgun.org”, “subject”: “ChangeDetection Notification - Change Detection” } }, “id”: “xxx” }

  • mailgun://postmaster@{sandboxid.mailgun.org}/{apikey}/mymail@gmail.com/?From=Luke%20Skywalker will work but not with a custom “From” Mailgun log :

{ “tags”: null, “timestamp”: 1666431713.4832542, “storage”: { “url”: “https://storage-us-west1.api.mailgun.net/v3/domains/sandboxid.mailgun.org/messages/xxx==”, “region”: “us-west1”, “key”: “xxx==”, “env”: “production” }, “envelope”: { “sender”: “postmaster@sandboxid.mailgun.org”, “transport”: “smtp”, “targets”: “mymail@gmail.com” }, “recipient-domain”: “gmail.com”, “event”: “accepted”, “method”: “HTTP”, “user-variables”: {}, “flags”: { “is-authenticated”: true, “is-test-mode”: false }, “log-level”: “info”, “originating-ip”: “myip”, “message”: { “headers”: { “to”: “mymail@gmail.com”, “message-id”: “xxx@sandboxid.mailgun.org”, “from”: “postmaster@sandboxid.mailgun.org”, “subject”: “ChangeDetection Notification - Change Detection” }, “size”: 604 }, “recipient”: “mymail@gmail.com”, “id”: “xxx” }

  • mailgun://postmaster@{sandboxid.mailgun.org}/{apikey}/?From=Luke%20Skywalker&to=mailgmail%40gmail.com will work but not with a custom “From”

Regarding the mailgun log, it seems that into the 2nd example it uses the sender as the recipient what causes this reject error

💡 Screenshots and Logs image

💻 Your System Details:

  • OS: W10
  • Python Version: Python v3.10.8

🔮 Additional context I’m using apprise via changedetection.io from @dgtlmoon (installed into a docker container on my QNAP nas) I post the issue here because I think it’s more appropriate to analyze it.

My initial goal was to adding a custom “From” with user & mail like this (mailgun log from a notification launched by urlwatch :

{ “tags”: null, “timestamp”: 1666427644.0839264, “storage”: { “url”: “https://storage-us-west1.api.mailgun.net/v3/domains/sandboxid.mailgun.org/messages/xxx==”, “region”: “us-west1”, “key”: “xxx==”, “env”: “production” }, “envelope”: { “sender”: “postmaster@sandboxid.mailgun.org”, “transport”: “smtp”, “targets”: “mymail+urlwatch@gmail.com” }, “recipient-domain”: “gmail.com”, “event”: “accepted”, “method”: “HTTP”, “user-variables”: {}, “flags”: { “is-authenticated”: true, “is-test-mode”: false }, “log-level”: “info”, “originating-ip”: “xxx”, “message”: { “headers”: { “to”: “mymail+urlwatch@gmail.com”, “message-id”: “xxx@sandboxid.mailgun.org”, “from”: “urlwatch mymail@gmail.com”, “subject”: “3 changes: Newly Added, Something Changed, Error Reporting” }, “size”: 4270 }, “recipient”: “mymail+urlwatch@gmail.com”, “id”: “xxx” }

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
caronccommented, Nov 1, 2022

Glad to hear! Thanks also @amotl for chiming in!

0reactions
pokemaster974commented, Nov 1, 2022

Thanks for the fix @amotl 👍 Regarding the PR, it seems to work now @caronc ! Here is the mailgun log with the tested branch :

{
	"tags": null,
	"timestamp": 1667337956.9210346,
	"storage": {
		"url": "https://storage-us-east4.api.mailgun.net/v3/domains/sandboxid.mailgun.org/messages/xxx==",
		"region": "us-east4",
		"key": "xxx==",
		"env": "production"
	},
	"envelope": {
		"sender": "postmaster@sandboxid.mailgun.org",
		"transport": "smtp",
		"targets": "mymail@gmail.com"
	},
	"recipient-domain": "gmail.com",
	"event": "accepted",
	"method": "HTTP",
	"user-variables": {},
	"flags": {
		"is-authenticated": true,
		"is-test-mode": false
	},
	"log-level": "info",
	"originating-ip": "myip",
	"message": {
		"headers": {
			"to": "mymail@gmail.com",
			"message-id": "xxx@sandboxid.mailgun.org",
			"from": "changedetection <mymail@gmail.com>",
			"subject": "Test Title"
		},
		"size": 345
	},
	"recipient": "mymail@gmail.com",
	"id": "xxx"
}

The header part of the mail :

Sender: mymail=gmail.com@sandbox.mgsend.net
Date: Tue, 01 Nov 2022 21:25:56 +0000
Mime-Version: 1.0
Subject: Test Title
From: changedetection <mymail@gmail.com>
To: mymail@gmail.com
X-Mailgun-Skip-Verification: false
Message-Id: <xxx@sandboxid.mailgun.org>
Content-Transfer-Encoding: 7bit
Content-Type: text/html; charset=ascii

image

I let you close if you have finished with this issue, many thanks !

Read more comments on GitHub >

github_iconTop Results From Across the Web

User Manual — Mailgun API documentation
When adding members to a Mailing List you can also define your own variables in addition to these pre-defined variables by using the...
Read more >
'from' parameter is missing · Issue #92 · mailgun ... - GitHub
So far I've tried upgrading form-data from 2.5.1 to 3.0.0, but still no luck. It seems like in the previous version of mailgun-js,...
Read more >
Mailgun The parameters passed to the API were invalid
Redacted The log to paste when you open a support issue: The parameters passed to ... EDITED to add this: One other Post...
Read more >
How to add custom parameters in html mail sent via Mailgun ...
Lets say "projectName" is my custom parameter then I tried to add proejctName ... If I have more than one custom paramter, do...
Read more >
Mailgun Integration - MagicBell
Add the email address and name you want your notification emails to come from. ... notifications through your Mailgun account, no additional work...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found