.yaml`.'
required: false
ecosystem:
description: 'Regenerate **all** tests for a package-manager, e.g. `npm_and_yarn`, `go_modules`, `pip`.'
required: false
core-branch:
description: 'A `dependabot-core` branch name to build a custom updater image from (for internal branches).'
required: false
core-pr-number:
description: 'A `dependabot-core` PR number to build a custom updater image from (for any PR including forks).'
required: false
```
--------------------------------
### Initialize SyntaxHighlighter
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/test_script/test.html
Call this function to apply SyntaxHighlighter to all code blocks on the page.
```javascript
SyntaxHighlighter.all();
```
--------------------------------
### Generate a Dependabot Test File
Source: https://github.com/dependabot/smoke-tests/blob/main/README.md
Use this command to create a new test file. It includes the specified inputs and adds ignore conditions for reproducibility. The output is saved to a YAML file.
```bash
dependabot update go_modules dependabot/smoke-tests -o my-test.yml
```
--------------------------------
### Include PHPMailer and POP3 Classes
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/docs/pop3_article.txt
Include the necessary PHPMailer and POP3 class files before using them. Ensure the paths are correct relative to your project structure.
```php
require 'phpmailer-1.72/class.phpmailer.php';
require 'phpmailer-1.72/class.pop3.php';
```
--------------------------------
### Use Custom Extended PHPMailer Class
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/docs/extending.html
Demonstrates how to instantiate and use a custom PHPMailer class that has been extended with specific default configurations.
```php
require("mail.inc.php");
// Instantiate your new class
$mail = new my_phpmailer;
// Now you only need to add the necessary stuff
$mail->AddAddress("josh@example.com", "Josh Adams");
$mail->Subject = "Here is the subject";
$mail->Body = "This is the message body";
$mail->AddAttachment("c:/temp/11-10-00.zip", "new_name.zip"); // optional name
if(!$mail->Send())
{
echo "There was an error sending the message";
exit;
}
echo "Message was sent successfully";
```
--------------------------------
### Build Updater from Dependabot-Core PR
Source: https://github.com/dependabot/smoke-tests/blob/main/README.md
Use this script to build the updater image from a specific dependabot-core PR. Requires the `gh` CLI.
```bash
script/regen.sh --core-pr 12345 tests/smoke-python-pip.yaml tests/smoke-python-pip-compile.yaml
```
--------------------------------
### Enable Caching for Dependabot Tests
Source: https://github.com/dependabot/smoke-tests/blob/main/README.md
To improve reproducibility, enable caching by specifying a directory with the `--cache` option. The Proxy will use these cached messages instead of making network calls if they exist.
```bash
dependabot test --cache tmp/cache
```
--------------------------------
### Configure SyntaxHighlighter Clipboard SWF
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/test_script/test.html
Set the path to the clipboard SWF file for SyntaxHighlighter's copy-to-clipboard functionality.
```javascript
SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';
```
--------------------------------
### Run a Dependabot Test
Source: https://github.com/dependabot/smoke-tests/blob/main/README.md
Execute a previously generated test file. This command runs Dependabot with the inputs from the test file and asserts that the outputs match the recorded values.
```bash
dependabot test -f my-test.yml
```
--------------------------------
### POP3 Authorize Method Parameters
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/docs/pop3_article.txt
Details the parameters required for the POP3 Authorise method. These include server details, credentials, and debug level.
```php
$pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);
```
--------------------------------
### Send Multiple Emails with Attachments from Database
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/docs/extending.html
Demonstrates sending multiple emails with HTML and plain text bodies, binary attachments, and multipart/alternative support, fetching recipient data from a MySQL database.
```php
require("class.phpmailer.php");
$mail = new phpmailer();
$mail->From = "list@example.com";
$mail->FromName = "List manager";
$mail->Host = "smtp1.example.com;smtp2.example.com";
$mail->Mailer = "smtp";
@MYSQL_CONNECT("localhost","root","password");
@mysql_select_db("my_company");
$query ="SELECT full_name, email,photoFROM employeeWHEREid=$id";
$result=@MYSQL_QUERY($query);
while ($row = mysql_fetch_array ($result))
{
// HTML body
$body = "Hello " . $row["full_name"] . ", ";
$body .= "Your personal photograph to this message.
";
$body .= "Sincerely,
";
$body .= "phpmailer List manager";
// Plain text body (for mail clients that cannot read HTML)
$text_body = "Hello " . $row["full_name"] . ", \n\n";
$text_body .= "Your personal photograph to this message.\n\n";
$text_body .= "Sincerely, \n";
$text_body .= "phpmailer List manager";
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($row["email"], $row["full_name"]);
$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");
if(!$mail->Send())
echo "There has been a mail error sending to " . $row["email"] . "
";
// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();
}
```
--------------------------------
### Add New Smoke Tests
Source: https://github.com/dependabot/smoke-tests/blob/main/README.md
Command to add new smoke tests by updating the Dependabot CLI. Ensure manifests are pushed before running, and substitute appropriate values for ecosystem, directory, commit SHA, and test name.
```bash
dependabot update $ecosystem dependabot/smoke-tests --directory $dir --commit $previous_commit_sha -o tests/smoke-$ecosystem-$testname.yaml
```
--------------------------------
### Check Dependabot Test Failures with Output Diff
Source: https://github.com/dependabot/smoke-tests/blob/main/README.md
When a test fails, use the `-o` option to write new outputs to a specified file. This allows for an easy comparison (diff) between the expected and actual results.
```bash
dependabot test -f input.yml -o output.yml
diff input.yml output.yml
```
```bash
dependabot test -f test.yml -o test.yml
```
--------------------------------
### Extend PHPMailer Class with Custom Defaults
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/docs/extending.html
Shows how to extend the PHPMailer class to create a custom mailer with predefined default settings and custom error handling.
```php
require("class.phpmailer.php");
class my_phpmailer extends phpmailer {
// Set default variables for all new objects
var $From = "from@example.com";
var $FromName = "Mailer";
var $Host = "smtp1.example.com;smtp2.example.com";
var $Mailer = "smtp"; // Alternative to IsSMTP()
var $WordWrap = 75;
// Replace the default error_handler
function error_handler($msg) {
print("My Site Error");
print("Description:");
printf("%s", $msg);
exit;
}
// Create an additional function
function do_something($something) {
// Place your new code here
}
}
```
--------------------------------
### Enable Specific Strict Rules
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpstan/phpstan-strict-rules/README.md
Re-enable individual strict rules by setting their specific parameter to true after disabling all rules.
```neon
parameters:
strictRules:
allRules: false
booleansInConditions: true
```
--------------------------------
### Handle Secrets with Environment Variables
Source: https://github.com/dependabot/smoke-tests/blob/main/README.md
Configure credentials for services like npm registries using environment variables to keep secrets out of test files. The token is referenced using shell variable syntax.
```yaml
credentials:
- type: npm_registry
registry: https://npm.pkg.github.com
token: $MY_TOKEN
```
--------------------------------
### POP3 Before SMTP Authentication and Email Sending
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/docs/pop3_article.txt
This snippet demonstrates how to perform POP3 authentication before sending an email using PHPMailer. It includes connection parameters for the POP3 server and PHPMailer configuration.
```php
$pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);
$mail = new PHPMailer();
$mail->SMTPDebug = 2;
$mail->IsSMTP();
$mail->IsHTML(false);
$mail->Host = 'relay.example.com';
$mail->From = 'mailer@example.com';
$mail->FromName = 'Example Mailer';
$mail->Subject = 'My subject';
$mail->Body = 'Hello world';
$mail->AddAddress('rich@corephp.co.uk', 'Richard Davey');
if (!$mail->Send()) {
echo $mail->ErrorInfo;
}
```
--------------------------------
### Regenerate Smoke Test Files Locally
Source: https://github.com/dependabot/smoke-tests/blob/main/README.md
The `script/regen.sh` script regenerates smoke test files locally. It can also use a custom updater image or build from a local `dependabot-core` checkout for testing unreleased changes.
```bash
script/regen.sh tests/smoke-bundler.yaml
```
```bash
script/regen.sh --updater-image my-image:latest tests/smoke-bundler.yaml
```
```bash
script/regen.sh --local-core ../dependabot-core tests/smoke-python-pip.yaml
```
--------------------------------
### Disable All Strict Rules
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpstan/phpstan-strict-rules/README.md
Configure PHPStan to disable all strict rules by setting 'allRules' to false in the parameters.
```neon
parameters:
strictRules:
allRules: false
```
--------------------------------
### Enable SMTP Debugging in PHPMailer
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/examples/index.html
Insert this after $mail->IsSMTP(); to enable SMTP debug information for testing. A setting of 2 will display all errors and messages generated by the SMTP server.
```php
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
```
--------------------------------
### Secure DKIM Private Key with .htaccess
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/docs/DomainKeys_notes.txt
Protect your DKIM private key file from unauthorized access by configuring your .htaccess file. This prevents the private key from being viewed or downloaded.
```apache
# secure htkeyprivate file
order allow,deny
deny from all
```
--------------------------------
### Secure DKIM Public Key with .htaccess
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/docs/DomainKeys_notes.txt
Protect your DKIM public key file from unauthorized access by configuring your .htaccess file. This prevents the public key from being viewed or downloaded.
```apache
# secure htkeypublic file
order allow,deny
deny from all
```
--------------------------------
### PHPMailer Gmail SMTP Configuration
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/docs/use_gmail.txt
This snippet shows the essential configuration for sending emails using Gmail's SMTP server with PHPMailer. Ensure you have included the PHPMailer and SMTP classes.
```php
IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port
$mail->Username = "yourname@gmail.com"; // GMAIL username
$mail->Password = "password"; // GMAIL password
$mail->From = "replyto@yourdomain.com";
$mail->FromName = "Webmaster";
$mail->Subject = "This is the subject";
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML($body);
$mail->AddReplyTo("replyto@yourdomain.com","Webmaster");
$mail->AddAttachment("/path/to/file.zip"); // attachment
$mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment
$mail->AddAddress("username@domain.com","First Last");
$mail->IsHTML(true); // send as HTML
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message has been sent";
}
?>
```
--------------------------------
### Enable SMTP Debugging in PHPMailer
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/docs/Note_for_SMTP_debugging.txt
Set the `SMTPDebug` property to a value of 1 or 2 to enable debugging. This will output errors and messages to help diagnose SMTP connection issues. Remember to disable debugging before deploying to production.
```php
$mail->SMTPDebug = 1;
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 26; // set the SMTP port
$mail->Host = "mail.yourhost.com"; // SMTP server
$mail->Username = "name@yourhost.com"; // SMTP account username
$mail->Password = "your password"; // SMTP account password
```
--------------------------------
### Disable Specific Strict Rules
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpstan/phpstan-strict-rules/README.md
Disable specific strict rules by setting their corresponding parameter to false in the PHPStan configuration.
```neon
parameters:
strictRules:
disallowedLooseComparison: false
booleansInConditions: false
uselessCast: false
requireParentConstructorCall: false
disallowedConstructs: false
overwriteVariablesWithLoop: false
closureUsesThis: false
matchingInheritedMethodNames: false
numericOperandsInArithmeticOperators: false
strictCalls: false
switchConditionsMatchingType: false
noVariableVariables: false
```
--------------------------------
### Setting PHPMailer Language
Source: https://github.com/dependabot/smoke-tests/blob/main/composer/vendor/phpmailer/phpmailer/README.md
This snippet shows how to set a specific language for PHPMailer's error messages. The language file should be placed in the specified directory.
```php
// To load the French version
$mail->SetLanguage('fr', '/optional/path/to/language/directory/');
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.