alexandresalome / mailcatcher Goto Github PK
View Code? Open in Web Editor NEWA library to manipulate Mailcatcher API
License: MIT License
A library to manipulate Mailcatcher API
License: MIT License
I think this:
Content-Type: multipart/mixed;
boundary=frontier
MIME-Version: 1.0
This is a message in Mime Format. If you see this, your mail reader does not support this format.
--frontier
Here is the real content
is legit (http://en.wikipedia.org/wiki/MIME#Multipart_messages) but throws an Exception if that's what the message looks like
1) Alex\MailCatcher\Tests\MessagePartTest::testMultiPartWithAMimeFormatWarningMessage
InvalidArgumentException: Error while parsing "Expected "--=_dba29f3ae3414895d994f90b8b013498", but got "This is a message in Mime Format. I" (This is a )" (cursor: 0, text: "This is a ").
#0 /home/matt/projects/mailcatcher/Mime/Parser.php(50): Alex\MailCatcher\Mime\Parser->consume('--=_dba29f3ae34...')
#1 /home/matt/projects/mailcatcher/Mime/Parser.php(20): Alex\MailCatcher\Mime\Parser->doParseBoundary('=_dba29f3ae3414...')
Hi @alexandresalome,
Could you create a release from the latest commit on master, to add Symfony 5 support on the latest tag, please?
Hi, i have just a suggestion to do to update documentation.
It would be easier to add how to add MailCatcherContext
to behat.yml in order to be available to use mail test functions in scenario.
Then, in behat.yml
you need to add this context in the list:
- Alex\MailCatcher\Behat\MailCatcherContext
.
Otherwise, it does not work.
to quick.. issue closed here and added to mailcatcher SMTP server
sj26/mailcatcher#462
Hi @alexandresalome,
Could you create a release from the latest commit on master, to add Symfony 7 support on the latest tag, please?
It'd be great to have access to a trait I can include in my suites contexts that gives me access to the same functionality rather then loading this as a sub-context.
@alexandresalome could you create a new release which will contain #9 ? Thanks a lot!
Fist of all, superb solution to a common problem. Nice!
I'm having trouble opening email. The assertion And 1 mail should be sent
works fine, but any way to open email fails.
The scenario: And I open mail with subject "Password reset"
Shows: Unable to find a message with criterias "{"subject":"Password reset"}".
But I'm sure the email is sent and the subject is indeed Password reset (I checked it manually in mailcatcher). Any ideas? I'm running mailcatcher 0.5.12
I have the following behat.yml file:
default:
suites:
default:
paths: [%paths.base%/features/]
contexts:
- FeatureContext
- Behat\MinkExtension\Context\MinkContext
- Alex\MailCatcher\Behat\MailCatcherContext
extensions:
Behat\MinkExtension:
base_url: "http://login.dev"
sessions:
default:
goutte: ~
javascript:
selenium2: ~
Alex\MailCatcher\Behat\MailCatcherExtension\Extension:
url: http://login.dev:1080
purge_before_scenario: true
I'm requiring behat 3 and your extension:
"require-dev": {
"behat/behat": "3.0.*",
"behat/mink-extension": "2.0.*",
"behat/mink-goutte-driver": "1.1.*",
"behat/mink-selenium2-driver": "1.2.*",
"alexandresalome/mailcatcher": "1.0.*"
}
Debugging the mailcatcher context in my own featurecontext file results in a Client with "http://localhost:1080" as url, which is the default value.
Changing "self::MAILCATCHER_ID" to "behat.mailcatcher.client" on line 54 in Extension.php resolved the issue for me, but I have not enough knowledge about your package for me to feel confident about creating a PR.
What is going wrong in my setup? Is my hardcoded fix actually desired?
Hi,
Is it possible to get stable v0.3.0 in the near future?
Best regards,
Michal
In the Behat context of one project, we extend the MailCacherContext
with the following line:
$this->mailCatcherContext = $environment->getContext('Alex\MailCatcher\Behat\MailCatcherContext');
We can't access to the current message because of the function declaration:
private function getCurrentMessage()
We can't change the visibility of this function since it may break classes that inherit from this class.
Can we add a public method in MailCatcherContext
to allow accessing to the current message?
I can submit a PR if you agree with this suggestion.
I'm creating Behat tests for a Laravel 5.2 project using Behat 3+, Laravel-Behat-Extension and this package.
My behat.yml
is as such:
default:
autoload:
- %paths.base%/tests/Behat/Features/Bootstrap/
suites:
default:
paths: [ %paths.base%/tests/Behat/Features ]
contexts:
- App\Tests\Behat\Features\Bootstrap\FeatureContext
- Behat\MinkExtension\Context\MinkContext
- Alex\MailCatcher\Behat\MailCatcherContext
extensions:
Laracasts\Behat: ~
Behat\MinkExtension:
default_session: laravel
laravel: ~
Alex\MailCatcher\Behat\MailCatcherExtension\Extension:
url: http://127.0.0.1:1080
purge_before_scenario: true
When I run
$ vendor/bin/behat
The feature tests "run", but at the end of a scenario I get this:
PHP Fatal Error: Uncaught Illuminate\Contracts\Container\BindingResolutionException:
Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable.
in /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:748
Stack trace:
...
When I comment out the MailCatcherContext in behat.yml
my suite works normally:
...
contexts:
- App\Tests\Behat\Features\Bootstrap\FeatureContext
- Behat\MinkExtension\Context\MinkContext
#- Alex\MailCatcher\Behat\MailCatcherContext
...
The MailCatcherContext is loading OK, as $ vendor/bin/behat -dl
displays things like
...
default | When /^I purge mails$/
default | When /^I open mail from "([^"]+)"$/
...
Has this package been tested with Behat 3 and Laravel 5? Any tips on how to debug this and see whether the issue lives inside this package or Laravel?
I had an email (created with SwiftMailer) with only HTML text and a PDF attachment. This library couldn't parse the mail. Then I tried having a text/plain body and an alternative text/html body and finally the PDF attachment.
Both these scenario's didn't work - the problem occurs at line 112 of Part.php
.
Do you have an alternative? It seems the mail parser part of this library is just not generic enough to handle all kinds of mail types (including the not particularly exotic type of mail I'm using here). Maybe there is a stand-alone mail parser which could be used as a dependency of this library (I didn't look into this yet, but I will).
Hi,
I've forked and created a failing test (https://github.com/mattparker/mailcatcher/blob/master/Tests/MessagePartTest.php) which gives
1) Alex\MailCatcher\Tests\MessagePartTest::testMultiPartWithAttachment
InvalidArgumentException: Unable to parse multipart header: "multipart/mixed; boundary=f46d0447861ff9929f04f143ce67".
I assume that the parser needs to be able to recursively parse the message if there are multiple boundaries? I'll have a go at a fix and see if I can get a pull request together.
The test message was sent to myself from GMail so I think it ought to be parseable.
(And thanks for the lib, btw!)
Matt
Unable to parse header with content type
Content-Type: multipart/related; type="text/html"; boundary="b1_e8edc21b734355033c4c1981d9786e10"
Current regex in loadParts from Alex\MailCatcher\Mime\Part doesn't handle this.
It throws error.
Unable to parse multipart header: "multipart/related;type="text/html"; (InvalidArgumentException)
@alexandresalome this is an awesome tool, but I was just wondering if you were abandoning this project? Reason why I am asking is it would be great to use this with Behat 3. Any chances of this happening?
Cheers!
If I don't use mail assertions and server is not started
It should not fail.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.