Comments (10)
I didn't think anyone else was using plain text in emails.
Will check it but not now.
Also pull request welcome :)
from webtrees-reminder.
Anyone, who cares about own privacy uses plain text at least as default or even disables HTML at all...
I tried two html2text libraries https://github.com/mtibben/html2text and https://github.com/soundasleep/html2text both are able to create plain text results from your HTML like mails, with slightly better results in first library but at cost of XML dependency. Using these libraries will allow to use real HTML, for more compatibility with different clients...
from webtrees-reminder.
I am able to get desired output with this:
<?php
/** @var string $subject */
/** @var \Illuminate\Support\Collection $items */
/** @var \Fisharebest\Webtrees\Fact $fact */
echo "<h2>$subject</h2>\n\n";
foreach ($items as $group => $facts) :
echo "<h3>$group</h3>\n";
echo "<ul>\n";
foreach ($facts as $fact) :
$record = $fact->record();
echo " <li>" . $fact->label() . ': ';
echo '<a href="' . e($record->url()) . '" style="text-decoration:none;">' . strip_tags($record->fullName()) . "</a> ";
$year = $fact->date()->display(false, '%Y');
if (!empty($year))
echo "(" . strip_tags($year) . " / " . strip_tags($fact->anniv) . ")";
echo "</li>\n";
endforeach;
echo "</ul><hr />\n";
endforeach;
// signature
echo '<p style="color:#444;">-- <br />'."\n";
echo "webtres</p>";
Notice, i changed the HTML slightly, i use unordered list of group's facts (ul), h2/h3 tags for titles and some styles are added. With this i got plain text:
4 apríla
Narodenie: Name Hidden (1962 / 59)
At end i add signature placeholder. IMO, here have to be info about unsubscribe, or at least link to webtrees, but i do not know how to get this URL.
I will suggest to add List-ID and List-Unsibscribe headers too, but i will create separate issue for this latter.
from webtrees-reminder.
List-ID and List-Unsibscribe is webtrees issue. Modules can't attach this headers.
from webtrees-reminder.
Not really ;-) only its send method is not suitable for purpose of this module. Because its transport method (thus mail settings) is reusable, it seems to be simple to implement...
I will try it latter as i recently did little play with SwitMailer, but my PHP knowledge are (very) limited (e.g. no OOP), it will need to be polished...
from webtrees-reminder.
@slavkoja try latest master version. Seems plain text message looks fine now.
from webtrees-reminder.
I will try soon.
But are you sure, that it is better to fix ugly HTML by calling four functions (including expensive regexp) instead of fixing HTML and stay on one function call?
from webtrees-reminder.
No ;)
from webtrees-reminder.
Do you want to help with HTML?
from webtrees-reminder.
You can use own html if you wish. For me prefer more readable variant without closing tags far away from opened :)
from webtrees-reminder.
Related Issues (20)
- Not recieving email HOT 16
- Can't send email HOT 6
- Is there a precedence of a flag vs. a date HOT 1
- User subscription HOT 13
- PHP error on WT 2.0.10 HOT 4
- No mail sent via sendmail HOT 5
- Failure with webtrees 2.1 HOT 2
- Add List-ID and List-Unsubscribe headers
- Allow weekly/monthly digest HOT 1
- not receiving e-mail HOT 2
- Message classified as SPAM HOT 2
- Marriage/divorce HOT 5
- Stopped sending Internal Server 500 HOT 1
- Incompatible with Webtrees 2.1.0 HOT 5
- E-Mail not send in any case of an event HOT 1
- remind only of a registered member's ancestors HOT 3
- I receive mail but another user don't HOT 1
- Not receiving email HOT 24
- Не отправляется письмо HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webtrees-reminder.