-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to test cc with mail hog #261
Comments
If by "test CC and BCC with mailhog" you mean being able to see, in MailHog e-mails sent with Sending an e-mail (using MailHog as SMTP server) with:
will create 3 separate e-mails in MailHog interface. PS: Setting the same recipient e-mail address for each header will still create 3 separate e-mails. |
If you download the email from Mailhog as an .eml file and open that file in a client like Thunderbird you'll clearly see the BCC & CC values. Inline images will also be visible. |
@C-Duv This is not true. I tested with this command and only one email is showing up, however, I can indeed see the headers: mhsendmail test@mailhog.local <<EOF
From: App <app@mailhog.local>
To: Test <test@mailhog.local>
Cc: <cc@mailhog.local>
Bcc: bcc@mailhog.local
Subject: Test message
Some content!
EOF I would like to understand what's the logic behind this: is the SMTP protocol smart enough to parse the message and send a single copy of each Bcc recipient while hiding others or should this logic be userland? |
@eexit I stand corrected then. I will check my setup then (I use both And I am looking forward an explanation / pointer to the documentation / code from the maintainer. Such internal behavior explanation could profit others. |
Hello, I've read some more documentation and compared 2 famous PHP email sending libraries (PHPMailer & SwiftMailer).
Some clients merge all recipients and trigger one transaction while others do one transaction for To+Cc and one transaction for each Bcc. So, to test Cc, you should only add your Cc and your SMTP client should include this header, while for the Bcc, it depends on your SMTP client: if it merges all recipients (To, Cc, Bcc), then you can't check from the UI this information. If the Bcc recipients are sent individually, then you'll see extra instances of your email. In any cases, check the MH logs. Here's an example with PHPMailer: $mailer = new \PHPMailer();
$mailer->isSMTP();
$mailer->Port = 1025;
$mailer->Host = '127.0.0.1';
$mailer->setFrom('test@example.com');
$mailer->addAddress('recipient@example.com');
$mailer->addCC('copy@example.com');
$mailer->addBCC('hidden@example.com');
$mailer->Subject = 'Test Email';
$mailer->Body = 'Test email content';
$mailer->send();
|
for what it's worth, You must differentiate between what the mail client sees and what the smtp server in charge of delivery receives to transmit the email. the email So consider this: So, I don't know for MailHog, but assuming there is 1 address in each header TO, CC, BCC 3 identical emails would be sent to each of the addresses without any mention of the BCC address. |
Hi , can you let me know how i can test CC and BCC with mailhog or mhsendmail
The text was updated successfully, but these errors were encountered: