mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +00:00 
			
		
		
		
	 b716e902ba
			
		
	
	
		b716e902ba
		
	
	
	
	
		
			
			This utilises LibIMAP and LibWeb to provide an e-mail client. The only way currently to connect to a server and login is with a config file. This config file should be stored in ~/.config/Mail.ini Here is an example config file: ``` [Connection] Server=email.example.com Port=993 TLS=true [User] Username=test@example.com Password=Example!1 ``` Since this is stored in plaintext and uses a less secure login method, I'd recommend not using this on your main accounts :^) This has been tested on Gmail and Outlook. For Gmail, you either have to generate an app password if you have 2FA enabled, or enable access from less secure apps in your account settings.
		
			
				
	
	
		
			50 lines
		
	
	
	
		
			971 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
	
		
			971 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include "InboxModel.h"
 | |
| 
 | |
| InboxModel::InboxModel(Vector<InboxEntry> entries)
 | |
|     : m_entries(move(entries))
 | |
| {
 | |
| }
 | |
| 
 | |
| InboxModel::~InboxModel()
 | |
| {
 | |
| }
 | |
| 
 | |
| int InboxModel::row_count(GUI::ModelIndex const&) const
 | |
| {
 | |
|     return m_entries.size();
 | |
| }
 | |
| 
 | |
| String InboxModel::column_name(int column_index) const
 | |
| {
 | |
|     switch (column_index) {
 | |
|     case Column::From:
 | |
|         return "From";
 | |
|     case Subject:
 | |
|         return "Subject";
 | |
|     default:
 | |
|         VERIFY_NOT_REACHED();
 | |
|     }
 | |
| }
 | |
| 
 | |
| GUI::Variant InboxModel::data(GUI::ModelIndex const& index, GUI::ModelRole role) const
 | |
| {
 | |
|     auto& value = m_entries[index.row()];
 | |
|     if (role == GUI::ModelRole::Display) {
 | |
|         if (index.column() == Column::From)
 | |
|             return value.from;
 | |
|         if (index.column() == Column::Subject)
 | |
|             return value.subject;
 | |
|     }
 | |
|     return {};
 | |
| }
 | |
| 
 | |
| void InboxModel::update()
 | |
| {
 | |
|     did_update();
 | |
| }
 |