PEAR Mail using gmail SMTP won't send 2 emails in sucession - email

I have PEAR Mail and Mail_mime all working very nicely using gmail's SMTP server to send. Thanks to some posts on here that helped me get that far!
But, in some scenarios, I need to send two emails, with different content, and to different recipients one right after the other. This is refusing to work.
I can confirm both the emails I am trying to send are well-formed and valid, as both will send with the other one commented out. But whenever I attempt to send them both, only the first gets through. I have tried putting php to sleep for 10 seconds in between, and I have tried sending the second email in a different script that gets called after the end of the first. Nothing.
I realise this is a pretty obscure problem as I found no other articles mentioning this. I haven't included any code because, as stated, I know the code works fine.
So I am hoping in vein that someone might have a bright idea as to why this might be.
Thanks in advance.

SOLVED: changing
include('Mail.php');
to
require_once('Mail.php');
fixed the problem.

Related

How to send multiple emails in MODX in single SMTP session?

I have a script that sends multiple emails in a loop. Between every email, I reset modMail:
$modx->mail->reset()
Sending becomes really slow since modMail needs to connect to the SMTP server again. I would like to send all emails in a single SMTP session.
I found that PHPMailer has a method clearAllRecipients but the modMail class does not have it. So the following command does not work:
$modx->mail->clearAllRecipients()
Is it safe to call PHPMailer's method directly with the following command:
$modx->mail->mailer->clearAllRecipients()
I am a little worried that something will get later broken if the PHPMailer changes. Or what would be a better solution?
PHPMailer's API isn't likely to change in any way like that precisely because it would cause BC breaks. Doing what you suggest should work just fine, though remember you'll need to also set SMTPKeepAlive = true to make it do this. See the reference implementation in the PHPMailer mailing list example.
If you think that this is something that other modx users would benefit from, you could add it to the wrapper they provide (and submit a PR for it) so that you can be abstracted away from PHPMailer's internal API, and thus protected from future changes that way.

Listed in Razor 2 Nobody on the internet knows an answer

I wanted to start a small campaign of about 400-500 emails and I tested the email with mail-tester.com
The problem is that I've got these 2 errors and nobody on the internet knows an answer for it:
-2.43 RAZOR2_CF_RANGE_E8_51_100 Razor2 gives engine 8 confidence level above 50%
-1.729 RAZOR2_CHECK Listed in Razor2 (http://razor.sf.net/)
This happends for both the domain and subdomain. I tried sending an email with a completely changed text (something about animals I've found on wikipedia) and without signature, I even tried sending an empty email and got the same misterious errors.
I tried sending the exact same mail + signature from another domain and it worked perfectly without any error.
What should I try next, considering the fact that it's impossible to change the domain name?
How popular is SpamAssasin with its Razor 2 or is it maybe irrelevant?
Should I wait or on the contrary send as many emails as possible to detect clean traffic?
Thanks

Giving an automatic email reply based on reading the subject line

I have been toying with this idea for few days now.
What I want to do is: I have a powershell script which sends mails mentioning status of some links which I am monitoring.
I wanted to add its functionality. I wanted to add a feature like, when a user sends the mail to a particular email ID with a subject line like "Status", it should send the user, the result of the powershell script.
From my perspective, an IMAP configuration needs to be done in the script. But just wanted opinion if this idea is feasible or not. I have IMAP configured in my organization. I just need to learn how to configure the script with IMAP settings so that the script can send automatic replies after reading the subject line.
IF this is possible from any other technology, then I would like to learn that as well.
EDIT:
Its not a duplicate, because here I want to know pretty basic stuff, like if its possible, and if it is, then what are the technology I need to use to make it possible. Let me know your suggestions.
I saw the duplicate question as well; well it hasn't been properly answered and the links given don't work.
Please help me here.
Thanks in advance!

GNU mailman - questions and testing

I feel really stupid asking this question, but I recently signed up to a GNU mailman list for the first time ever and can't quite figure out how to interact with it properly. I can't find any documentation anywhere on how to participate as a list member. In particular, I am trying to figure out how to make my responses nest properly when replying from a Gmail account. Through some sparse info I've gleaned, I found that the "In-Reply-To" header is supposedly the one that determines where your message nests on the list.
So, I posted a new message to the list, and when somebody replied to me, I received a copy in my Gmail in addition to the post on the list archives page. I replied to the Gmail and addressed it back to the main list address. After sending, I examined the Gmail headers, and In-Reply-To was indeed set to the Message-ID of the person who had replied to me, so I thought my response would be nested under his. Unfortunately, it was not. It was nested underneath my own OP, next to his. I can't figure out why, except that there is another header References, which in my response, included two Message-ID's, both the one from my original post, and the one from the first response.
None of this stuff is intuitive at all or explained anywhere that I can find, and Gmail of course gives you no control of email headers... but I don't want to switch to an entirely new mail service just to interact with a Mailman list. Nor do I want to spam a real list with a bunch of stupid test messages of me figuring out what is probably supposed to be a very simple system. Does anybody know of a test instance of mailman somewhere that I can send a few mails to just so get this all sorted out? I found what appeared to be a couple, but none of them were actually accepting mail.

How do I get the email in a script running from my .forward-file?

I am writing a script to handle an automated email inbox. I've never really dealt with mail servers before, but have gotten to a point where every email sent is executing my script. I am using a .forward file in the home directory of the recipient user that looks like this:
"|exec /home/[MY USER]/magic || exit 75 #[MY USER]"
The script simply takes it's input and writes it to a file at this point. The problem is, I don't know how to find the email being sent, and I can't seem to find any documentation on how the .forward-file works in detail. How do I get to the email?
Any help is greatly appeciated :)
Some general information about the ~/.forward file and the interaction with the mail server is described here, and the Filtering Mail FAQ also contains some information.
While just using a dot-forward file might be sufficient you very typically want to use procmail for more powerful mail processing.