-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched from mailtrap to mailslurper
- Loading branch information
Showing
6 changed files
with
88 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
import { defineConfig } from "cypress"; | ||
|
||
export default defineConfig({ | ||
let config = { | ||
e2e: { | ||
supportFile: false, | ||
excludeSpecPattern: "**/*.mailtrap.cy.ts", | ||
screenshotsFolder: "cypress/screenshots", | ||
excludeSpecPattern: "", | ||
}, | ||
}); | ||
reporterOptions: { | ||
mochaFile: "results/my-test-output.txt", | ||
toConsole: true, | ||
}, | ||
}; | ||
|
||
if (process.env.CYPRESS_MSMTP_ENABLED ?? false) { | ||
config.e2e.screenshotsFolder = "cypress/screenshots/msmtp"; | ||
} else { | ||
config.e2e.excludeSpecPattern = "**/*.msmtp.cy.ts"; | ||
} | ||
|
||
export default defineConfig(config as Cypress.ConfigOptions); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
describe("Send mail with PHP", () => { | ||
it("Should send an email with PHP", () => { | ||
// Send email through PHP (response of mail-test.php is the email subject) | ||
cy.request("localhost/mail-test.php").then((response) => { | ||
// Verify that the email arrived | ||
cy.request({ | ||
url: "localhost:8085/mail", | ||
qs: { | ||
message: response.body, | ||
}, | ||
}).should((response) => { | ||
expect(response.body.totalRecords).to.eql(1); | ||
let mail = response.body.mailItems[0]; | ||
expect(mail.fromAddress).to.eql("baikal@example.com"); | ||
expect(mail.toAddresses).to.eql(["to@example.com"]); | ||
expect(mail.body).to.eql("Email sent with PHP mail()\n"); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
<?php | ||
mail("to@example.com", $_REQUEST["subject"], "Email sent with PHP mail()"); | ||
try { | ||
$subject = uniqid(); | ||
$mail_result = mail("to@example.com", $subject, "Email sent with PHP mail()"); | ||
|
||
if ($mail_result) { | ||
echo $subject; | ||
} else { | ||
throw new Exception("mail(...) returned false"); | ||
} | ||
} catch (\Throwable $th) { | ||
http_response_code(500); | ||
echo $th->getMessage(); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"wwwAddress": "0.0.0.0", | ||
"wwwPort": 8080, | ||
"wwwPublicURL": "", | ||
"serviceAddress": "0.0.0.0", | ||
"servicePort": 8085, | ||
"servicePublicURL": "", | ||
"smtpAddress": "0.0.0.0", | ||
"smtpPort": 2500, | ||
"dbEngine": "SQLite", | ||
"dbHost": "", | ||
"dbPort": 0, | ||
"dbDatabase": "./mailslurper.db", | ||
"dbUserName": "", | ||
"dbPassword": "", | ||
"maxWorkers": 1000, | ||
"keyFile": "", | ||
"certFile": "", | ||
"adminKeyFile": "", | ||
"adminCertFile": "", | ||
"authenticationScheme": "", | ||
"authSecret": "", | ||
"authSalt": "", | ||
"authTimeoutInMinutes": 120, | ||
"credentials": {} | ||
} |