![]() $mail->Host = " " // specify main and backup server $mail->IsSMTP() // set mailer to use SMTP The only difference from the example is the loop for AddAddress, and the inclusion of $to as a global variable. This is from the PHPmailer website, and is what is defined as SendMail(). The first email will work fine, the second will not. The above is how I want this to work, as it would work with mail(). $message = $message_start.$message_TWO.$message_end $message = $message_start.$message_ONE.$message_end I haven't included the source code, although it is all available on the link provided above. Is there a way of stacking these requests so that I can send successive emails without it failing? Forcing the script to wait until the first email has been sent would also be acceptable, although not preferential.Īs I mentioned I know it works when only one instance is called, but I don't seem to be able to re-use the function. The above would result in two identical emails being sent to different people, however I can't easily replicate this functionality with PHPmailer. Mail($to2, $subject, $message, $headers) Previously I was using the in-built mail() function, which allowed me to use it as many times as I liked in quick succession, but it doesn't appear to be that simple with PHPmailer: $to = 'php headers etc' However, if I attempt to call more than one instance of SendMail() I get the error message: Fatal error: Cannot override final method Exception::_clone() in. The script is almost completely 'out of the box', with only a few modifications such as a foreach loop to allow for multiple addresses, and everything still works perfectly. I'm having some trouble with PHPMailer ( ) when attempting to send two emails, one directly after the other. Once you’ve logged in, find the relevant domain(s) under your Websites and Domains tab, and access the Mail Settings page.Edit: I forgot I'd created the SendMail() function myself, which is why the explanation doesn't mention at first what it does. If your hosting provider is using Plesk, what you want to do is deactivate the mail service on the domain(s) that your hosting provider is providing web service for. Here, I’m listing the fixes for 2 platforms:Īrticle continues after the advertisement: Plesk ![]() ![]() The specific way will depend on the server control interface that your mass hosting service provides. Once the problem was identified, fixing it was simple. More concisely, we can also say that the server was routing domain emails locally. This meant that it routed all emails to the domain into the mailboxes under its own mail service. The problem, it turns out, was the web server’s email routing policy - because the web server was also configured as a mail server for, it considers itself the mail server for the domain. It could deliver emails to other domains with no problem, but it couldn’t deliver emails to its own domain! This meant that the emails were not getting delivered by the web server at all. If these emails were getting rejected, however, Google Workspace’s mail logs should still indicate this, and they weren’t! I was wrongly certain that Google Workspace must’ve been rejecting the emails sent from the contact form as spam because something was set up wrongly, like the domain’s SPF record. Finding the problemįor weeks, it didn’t occur to me that the above-mentioned catch could be what’s causing the problem. ![]() However, because their MX records are not pointed to this server, it does not receive any of their domain emails. Here’s the catch: The server that provides their web service also provides an email service, like many mass hosting services. ![]() for when you send emails to their domain) is provided by Google Workspace, so the MX records for their domain are pointed to Google’s SMTP servers. This server runs the website, so it’s the one that is working when you visit their website at. HTTP and HTTPS) is provided by a mass hosting server. To understand why this was happening, we need to first understand how the client’s website and email service is set up. then the email would go through (and skip right past the spam folder too).įor weeks, this problem confounded me, until now… and it’s actually a really simple fix. If we delivered the email to our own personal email addresses (e.g. This means that, if we were to set the form to deliver enquiries to an address like the email would be completely dropped - you would neither find it in the junk or spam folders, nor find any trace of the email in their admin and mail logs. Recently, I’ve done some work for a client with an odd issue: the contact forms on their website (let’s call it ) - which delivered completed form enquiries using PHP’s mail() function - could not send emails through to email addresses containing their own domain. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |