Skip to content
This repository has been archived by the owner on Mar 28, 2021. It is now read-only.

Delete Option ?! #5

Closed
Spegeli opened this issue Dec 19, 2016 · 7 comments
Closed

Delete Option ?! #5

Spegeli opened this issue Dec 19, 2016 · 7 comments

Comments

@Spegeli
Copy link

Spegeli commented Dec 19, 2016

First i have to say thx for this amazing script.
It's simple but it does what it should ;-)

The only thing i'm missing is a option to delete a message.
Maybe its possible for you to add this?!

@synox
Copy link
Owner

synox commented Dec 19, 2016

Pull request welcome. It's easy, look at the example here: https://github.com/synox/disposable-email-imap/blob/master/index.php#L77

@Spegeli
Copy link
Author

Spegeli commented Dec 19, 2016

Here is the solution:

index.html

                        <div class="col-sm-12 email-summary">{{mail.subject}}
                        <form class="form-inline float-xs-right">
                            <button ng-click="$ctrl.deleteMail(mail.id)" type="button" class="btn btn-outline-danger">Delete</button>
                        </form>
                        </div>

index.js

    self.deleteMail = function (mailid) {
        $http.get(backend_url, {params: {username: self.username, deletemail: mailid}});
        self.updateMails();
    };

index.php

if (isset($_GET['username'])) {
    print_inbox($_GET['username']);
} else {
    error(400, 'invalid action');
}
if (isset($_GET['deletemail'])) {
    delete_message($_GET['deletemail']);
}

backend.php (under the "deletes messages older than X days" function)

/**
 * deletes messages on request.
 */
function delete_message($id) {
    global $mailbox;
    
    $mailbox->deleteMail($id);
    $mailbox->expungeDeletedMails();
}

now it deletes the email when you click the Delete Button ^^

@synox
Copy link
Owner

synox commented Dec 19, 2016

Please fork this repo and create a pull request (https://guides.github.com/activities/forking/). This makes it much easier to discuss and allows me to run the code.

@Spegeli
Copy link
Author

Spegeli commented Dec 19, 2016

Sorry i dont want to fork it ;-)
You have the solution, use it or not ^^

@synox
Copy link
Owner

synox commented Dec 19, 2016

Why not fork? It's free and you delete it afterwards. That's how github works you know. ;-)

@synox
Copy link
Owner

synox commented Dec 19, 2016

Thanks anyway for the input. I improved it a bit and pushed to master branch.

@synox synox closed this as completed Dec 19, 2016
@synox synox reopened this Dec 19, 2016
@synox
Copy link
Owner

synox commented Dec 19, 2016

#2 must also be fixed here.

synox added a commit that referenced this issue Dec 19, 2016
synox added a commit that referenced this issue Dec 19, 2016
@synox synox closed this as completed Dec 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants