Jump to content

WireMailSmtp


horst

Recommended Posts

5 minutes ago, fruid said:

my SMTP-server has a limited amount of emails that it can send per day. Is there a way to find out if an email was actually sent or not?

You could try sending the emails via PostMark
It's easy to integrate with WireMail SMTP, credits are cheap and it'll give you a dashboard on amounts of emails sent/bounced etc

Link to comment
Share on other sites

On 11/22/2022 at 7:17 PM, fruid said:

thanks but no other service should be used. I just want to know if it's technically possible to know if an email was actually sent. I thought ->getResult() or the like would return an object of some sort.

Taken from

getResult () - returns a dump (array) with all recipients (to, cc, bcc) and settings you have selected with the message, the message subject and body, and lists of successfull addresses and failed addresses,

So you can check with the 'recipientsFailed' entry of the array if anything went wrong.

$result = $mail->getResult();
if(count($result['recipientsSuccess']) {
// logic for successful mails
}
if(count($result['recipientsFailed']) {
// logic for failed mails
}

Or you can use return value of ->send() which returns the count of successfully sent mails or 0 on fail:

$numberSentMails = $mail->send();

Log these numbers somewhere and add some logic to your send script that counts how many mails have been sent on the current day, adds them to a mail queue or whatever you need. 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...