I'm using PHPMailer to send email. My ics content is:
BEGIN:VCALENDAR
METHOD:REQUEST
VERSION:2.0
PRODID:-//FooBar//FooBar Calendar//EN
BEGIN:VEVENT
UID:8f5a0777-bf6d-17d2-f14a-52e7feedf810
ORGANIZER;CN=Foo:foo#bar.com
DTSTART:20140130T191500Z
DTEND:20140130T194500Z
DTSTAMP:20140129T144300Z
SUMMARY:Foo Bar 11
DESCRIPTION:
END:VEVENT
END:VCALENDAR
For some reason I don't see the expected RSVP buttons in any email clients. Both Gmail and Mac Mail simply include the ics as a file attachment, I assume as a fallback. So there must be something wrong. I have not tried Outlook, but I don't see any reason why it would be different in a third client. The contents of an email being sent are below. Can you see anything that looks incorrect? Thank you.
Return-Path: REDACTED
Received: REDACTED
Date: Wed, 29 Jan 2014 09:43:18 -0500
Return-Path: REDACTED
To: REDACTED
From: REDACTED
Reply-To: REDACTED
Subject: Meeting - Foo Bar 11
Message-ID: <7004961cd9df04181047296f98260834#localhost>
X-Priority: 3
X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_7004961cd9df04181047296f98260834"
Content-Transfer-Encoding: base64
--b1_7004961cd9df04181047296f98260834
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
VG86IEZvbyBCYXINCg0KDQpBZG1pbmlzdHJhdG9yIGhhcyBpbnZpdGVkIHlvdSB0byBhIE1lZXRpbmcNCg0KDQpTdWJqZWN0OiBGb28gQmFyIDExDQoNClN0YXJ0IERhdGU6IDAxLzMwLzIwMTQgMDI6MTVwbSBFU1QoLTA1OjAwKQ0KDQpFbmQgRGF0ZTogMDEvMzAvMjAxNCAwMjo0NXBtIEVTVCgtMDU6MDApDQoNCg0KRGVzY3JpcHRpb246IA0KDQoNCkFjY2VwdCB0aGlzIG1lZXRpbmc6DQoNCmh0dHA6Ly9sb2NhbGhvc3Q6ODg4OC9pbmRleC5waHA/ZW50cnlQb2ludD1hY2Nlc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HQU5JWkVSO0NOPUZvbzpmb29AYmFyLmNvbQ0KRFRTVEFSVDoyMDE0MDEzMFQxOTE1MDBaDQpEVEVORDoyMDE0MDEzMFQxOTQ1MDBaDQpEVFNUQU1QOjIwMTQwMTI5VDE0NDMwMFoNClNVTU1BUlk6Rm9vIEJhciAxMQ0KREVTQ1JJUFRJT046DQpFTkQ6VkVWRU5UDQpFTkQ6VkNBTEVOREFSDQo=
--b1_7004961cd9df04181047296f98260834--
P.S. Sorry about it being base64 encoded. I wanted to show a true representation of the email instead of changing it any way that may skew the results. I just use http://www.base64decode.org/ to decode the contents.
Don't know if it will solve your issue but:
your ORGANIZER property value should be a uri, so foo#bar.com instead of just foo#bar.com
you are missing the ATTENDEE property which is mandatory in an iTIP Request. See https://www.rfc-editor.org/rfc/rfc5546#section-3.2.2
As far as the MIME structure, and seems you seem to care about GMail, the best is to generate an invite from Google Calendar to a non google account, and look at the MIME structure that it generates.
Related
I'm trying to reply to the mail axel#example.com from user sam#example.com. This is the composed message:
Date: Tue, 27 Sep 2022 12:23:58 +0000
From: sam#example.com
Reply-To: Axel <axel#example.com>
Message-ID: <CAJ-JwXfBKUO0m0iG9NbEhCua7WbPWv2nSY0_J9_m0F-B-NEMNg#mail.gmail.com>
X-Mailer: PHPMailer 6.6.4 (https://github.com/PHPMailer/PHPMailer)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
To: Axel <axel#example.com>
Subject: Beautiful
WWVzLCBpdCBpcy4uLg==
The message correctly ends up inside thread of email sam#example.com.
But the messages do not appear at all in email axel#example.com.
Currently, I'm using PHPMailer to compose the raw message and use php gmail api to send messages:
$gm = new \Google\Service\Gmail($this->client);
return $gm->users_messages->send('me', $message);
I have a need for everyone in my organization to send emails to everyone else in the group.
As there are hundreds of members, and the membership changes often, it is not practical to use the traditional CPanel email forwarding method. So I thought I would pipe the email to a php script, get all the members’ email addresses from the database (checking to make sure the original sender was also in the database) and send on the email to all members using PHPMailer.
I parsed the header in the PHP script to get the From, Subject (adding these of course to PHPMailer), Content-Type, and boundary. Then I collected the actual email message in a variable $message including the lines that say (in this case)
“This is a multi-part message in MIME format.
--------------3D4FAACFC2C069EFCDAE6DC6, etc. (This is of course in text format.)
Just before the PHPMailer Send command, I included:
$mail -> IsHTML(false);
// (I also tried not including this command at all – no change)
$mail->Body =$message;
$mail->addCustomHeader("Content-Type", $content_type . " boundary=" . $boundary);
$content_type and $boundary are the variables I parsed from the original header
As this is still in development, I sent the email to my address only. It was received and displayed properly (both the plain and html as usual), but was marked as Spam – the received Header had the Subject already marked as Spam so I assume PHPMailer did it.
I noticed on the received Header that my custom header appeared correctly:
Content-Type: multipart/alternative; boundary="------------3D4FAACFC2C069EFCDAE6DC6"
The received header also had another Content-Type: text/plain; charset=iso-8859-1 after the above which I assume PHPMailer added. Maybe the two Content-Types is what triggered the Spam tag. I then tried adding $mail->header_remove ('Content-Type'); after the Body call and before addCustomHeader, but the additional Content-Type: text/plain; charset=iso-8859-1 was still in the received header and it was still marked as Spam.
I am using PHPMailer version 5.2.22, and using
$mail->IsSMTP();
, $mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
I can’t continue to unsuccessfully experiment forever as I am afraid sending lots of Spam emails will get me in trouble, so I am hoping someone can tell what I am doing wrong, or even if my overall strategy is flawed. I wish also there was a way to get the header that PHPMailer is going to use before it actually sends out the mail.
Note: my organization is a charitable group with little money, so we can't afford paid SMTP's. I've tried using the free versions of some on the market (not for the above project) but given you are using a shared IP with many others using the free service you often get emails kicked back because others sharing your IP have been Spam tagged
Thanks
This is the entire header (I deleted some of the content just to keep this note a bit brief) that I received to my personal email (b...#....com) from my "forward email" script which uses everybody#....org as the originating address. You can see the Content_Type I added to PHPMailer via $mail->addCustomHeader("Content-Type", $content_type . " boundary=" . $boundary);(which is the multipart.. line) and the one PHPMailer itself added (text/plain...). The email was received fine and displayed properly except for the Spam added to the Subject line:
From - Sat Mar 25 12:51:13 2017
STUFF
Return-Path: <everybody#....org>
Received: from dnvrco-pub-iedge-vip.email.rr.com ([107.14.70.244])
by dnvrco-fep06.email.rr.com
(InterMail vM.8.04.03.24 201-2389-100-172-20151028) with ESMTP
id <20170325165112.EUNA23395.dnvrco-fep06.email.rr.com#dnvrco-pub-iedge-vip.email.rr.com>
for <bmadder#...>; Sat, 25 Mar 2017 16:51:12 +0000
Return-Path: <everybody#....org>
Received: from [173.205.126.142] ...
Received: from ecbiz194.inmotionhosting.com .....
Date: Sat, 25 Mar 2017 12:51:01 -0400
To: b...#....com
From: everybody#....org
Message-ID: ...
Content-Type: multipart/alternative; boundary="------------3D4FAACFC2C069EFCDAE6DC6"
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-OutGoing-Spam-Status: No, score=-1.0
X-AntiAbuse:...
X-Get-Message-Sender-Via: ecbiz194.inmotionhosting.com: authenticated_id: everybody#....org
X-Authenticated-Sender: ecbiz194.inmotionhosting.com: everybody#....org
X-Source:
X-Source-Args:
X-Source-Dir:
X-Authority-Analysis: v=2.1 cv=Od5ldUnY c=1 sm=1 tr=0 p=tHMjoff1TzQA:10 a=BPsZ5WN3F+ptBTNoNLYonA==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=9+rZDBEiDlHhcck0kWbJtElFXBc=:19 a=6Iz7jQTuP9IA:10 a=FqPqrT7mAAAA:8 a=wuaQj91YKeLcW_I7NZUA:9 a=FtJ_xtNkBE-qfxEx:21 a=wPNLvfGTeEIA:10 a=yozH4VhRfl4A:10 a=M3AHoUkWFckA:10 a=fZGknuNN1LOydenUCIb6:22
X-Cloudmark-Score: 100
X-RR-Connecting-IP: 107.14.64.106:25
Subject: SPAM: Lots of work today
X-Brightmail-Tracker: AAAAARZYL6Q=
X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDqMTGxcIABLocC65FGFx/aGGx78B3FgdGj+Mv3jMFMEZx+OWXKAQXJOYmcGT07L7AVsBQAaIaGBlWMSqUlBYbF2cUJxYVF6RWGJjrpacW6xVX5ibmlaQm6yXn525ihJq+g3H7RZlTjJJS4ry3512LEBIoBpqYUQpUVxRfVJqTWvyKUZyDUUmYNxcky5OZV1KcmQ6TkeBgUhLhNdl4JUKIt7gkESEl1cDY81CZ25t3k/zUd21bd90/typmy6NtErw+Xs/YlXtk7atb4j4+/t6yoHDeJ3uN/kP1P7LrIiY5fFipZfynvvPJzbNfz943kPtyweqk3Tn/vpOfGIosVIpPxHht7j+Rl24XEH2vJa1o/q3fJRonvyxi6D4x60xlW8M/o0oLBlvjw4672ZjKQg2UWIozEg21mIuKEwGcu2V6TwEAAA==
This is a multi-part message in MIME format.
--------------3D4FAACFC2C069EFCDAE6DC6
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
This is the text message
--------------3D4FAACFC2C069EFCDAE6DC6
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>This is the text message <br>
</p>
</body>
</html>
--------------3D4FAACFC2C069EFCDAE6DC6--
I now have the solution. Rather than using the line of $mail->addCustomHeader("Content-Type", $content_type . " boundary=" . $boundary);, I appended the variable $boundary to the variable $content_type and used $mail->ContentType = $content_type; My mail forward script now works perfectly with the Spam label no longer an issue. The header that is sent to the final recipients no longer has duplicate Content-Types listed in the MIME part
I'm using php mail function to send emails to a rather long mailing list. It works great.
However, I know that many emails in my mailing list are obsolete and yet I'm not receiving a single failure delivery return.
This is what the code of my sent email looks like:
To: test#test.be
Subject: test
From: <test#test.be>
Reply-to: test#test.be
X-Mailer: PHP/7.0.2
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
boundary="-----=9cc0de4ea510d9961f665cefb88d8c3a"
Message-Id: <20160307160659.59354220C6#xxlplan.ovh.net>
Date: Mon, 7 Mar 2016 17:06:59 +0100 (CET)
X-Ovh-Tracer-Id: 12043469829572602714
Above, I replaced the real email address with test#test.be and the email is correct...
Thanks!
I'm using the following to generate a SwiftMail message (excuse the wrappers)
$message = $mailHelper->createMessage(); // This is an instance of Swift_Message
$message->setTo($addresses)
->setFrom([$template->getEmail() => $template->getName()])
->setSubject($template->getSubject())
->setBody($template->getTextContent($twig, $replacements), 'text/plain');
$message->addPart($template->getHtmlContent($twig, $replacements), 'text/html');
$mailHelper->sendMessage($message)
I receive the message ok, but in gmail it shows me the text version. All the encoding looks correct to me.
Return-Path: <[email]>
Received: from [127.0.0.1] (ec2-54-149-246-93.us-west-2.compute.amazonaws.com. [54.149.246.93])
by smtp.gmail.com with ESMTPSA id kv7sm1686300pab.20.2015.09.10.09.11.03
for <[email]>
(version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
Thu, 10 Sep 2015 09:11:04 -0700 (PDT)
Message-ID: <bf6b3e989767a5cab5ebf8ddbfc27040#swift.generated>
Date: Thu, 10 Sep 2015 16:11:03 +0000
Subject: Welcome to [App]
From: [Company] <[email]>
To: "[email]" <[email]>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="_=_swift_v4_1441901463_d2266ae39e8919de6200347d60861abb_=_"
--_=_swift_v4_1441901463_d2266ae39e8919de6200347d60861abb_=_
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
[url]
--_=_swift_v4_1441901463_d2266ae39e8919de6200347d60861abb_=_
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
[url]
--_=_swift_v4_1441901463_d2266ae39e8919de6200347d60861abb_=_--
So it turns out there were two mistakes.
1) Using a custom schema in the href (which I removed from the example above because I considered it sensitive). I guess gmail considers the schema dangerous and then strips the anchor. This is actually a good thing.
2) I was in fact seeing the content from the html version, it's just the only thing that was left was the url, which is what was in the text version too.
TL;DR: Don't use a custom schema for your mobile app in emails. Route it through a browser first.
I cant get the server to accept my email sent from my end basically i realise it's sending two super different stuff from laravel's mail comparing to hotmail & thunderbird
Basically ,What i normally do is to use hotmail to reply but now i have multiple hotmail i have to manage therefore i was trying to send the email from my web application (laravel) for easier management but the "server" i'm sending to doesnt accept my normal php mail format. I'm definately missing something. Any email experts can advice on this?
Suspect
My content is not BASE64
In-Reply-To < Not sure about this
I'm using Hotmail's SMTP
Normal PHP
X-TMN: [Rmqa/GDhCTtKz/QHzf3PJ3OwikNcUBK3]
X-Originating-Email: [My Email]
Message-ID: <BLU436-SMTP1442C473F3D4FDD87CB62F29A410#phx.gbl>
Return-Path: Email.com
Date: Wed, 14 Jan 2015 17:06:08 +0800
Subject: RE: Subject
From: My Email
To: "Email.com"
<Email.com>
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-OriginalArrivalTime: 14 Jan 2015 09:06:40.0049 (UTC) FILETIME=[68728A10:01D02FD9]
Email Content in pure Text here
Hotmail(Web based)/thunbird style
X-TMN: [vnGLLjV7gUOyWwB/t0Ipyc0a9UiAeX10]
X-Originating-Email: [My Email]
Message-ID: <BAY180-W3892FACB7ED35FBDFF773B9A410#phx.gbl>
Return-Path: My Email
Content-Type: multipart/alternative;
boundary="_4c14973f-4b86-4f73-b78c-eac0375a1262_"
From: My Email
To: "Email.com"
<Email.com>
Subject: RE: Subject
Date: Wed, 14 Jan 2015 17:03:32 +0800
Importance: Normal
In-Reply-To: <14ae7acae73.1948.26c1bd#ismtpd-063>
References: <14ae7acae73.1948.26c1bd#ismtpd-063>
MIME-Version: 1.0
--_4c14973f-4b86-4f73-b78c-eac0375a1262_
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: base64
<base64 here>
--_4c14973f-4b86-4f73-b78c-eac0375a1262_--
Manage to solve it, as suspected, it's Base64. Basically , I had to customize the content Type on my laravel.
$message->getHeaders()->addTextHeader('Content-Type', 'text/plain; charset="gb2312"');
$message->getHeaders()->addTextHeader('Content-Transfer-Encoding', 'base64');