How can I check failed mails. Swiftmailer is returning true even if i supply invalid email address. I need to log send and failed mails into database
$message = Yii::$app->mailer->compose();
$message->attach($protocal.$_SERVER['SERVER_NAME'].$payslip);
$message->setTo("tft#sjkdsjk.dfdh");
$message->setFrom("hr#gmail.com");
$message->setSubject($vStaffName." ".$vPeriodName. " Payslip");
$message->setTextBody("Find attached copy of your payslip. To open this document use your ID number as password");
$send = $message->send();
var_dump($send);die(); //returns true always
I would expect true or false
You should check with SMTP.
That means you have to connect to that email's SMTP server.
After connecting to the SMTP server you should send these commands:
HELO somehostname.com
MAIL FROM: <no-reply#gmail.com>
RCPT TO: <emailtovalidate#domain.com>
If you get " Relay access denied" that means this email is Invalid.
There is a simple PHP class. You can use it:
http://www.phpclasses.org/package/6650-PHP-Check-if-an-e-mail-is-valid-using-SMTP.html
Related
I am using gerrit 3.2.1
After I tried everything I can do to configure my gerrit.sendemail, I failed to send a verification mail
[sendemail]
enable = true
smtpServer = smtp.offce365.com
smtpServerPort = 587
smtpEncryption = ssl
sslVerify = false
smtpUser = gerrit#gerritserver.com
smtpPass = pswd
I refered to https://groups.google.com/forum/#!msg/repo-discuss/RWvdXR-Z4nA/1USSK1F6AAAJ\
but seems I met different problem,
For the encryption, according with office 365, the SMTP uses STARTTLS, but seems it always fail. I tried ssl, tls, neither works.
I also tried port 25.
[2020-06-16T14:33:53.834+0800] [WorkQueue-2] INFO com.googlesource.gerrit.plugins.deleteproject.fs.RepositoryCleanupTask : Cleaning up expired git repositories... Done
[2020-06-16T14:35:32.927+0800] [plugin-manager-preloader] INFO com.googlesource.gerrit.plugins.manager.OnStartStop : 66 plugins successfully pre-loaded
[2020-06-16T14:36:13.420+0800] [HTTP PUT /accounts/self/emails/name%40emailhost.com (flynn from 127.0.0.1)] ERROR com.google.gerrit.server.restapi.account.CreateEmail : Cannot send email verification message to name#emailhost.com
com.google.gerrit.exceptions.EmailException: Mail Error: Connection timed out (Connection timed out)
at com.google.gerrit.server.mail.send.SmtpEmailSender.open(SmtpEmailSender.java:437)
at com.google.gerrit.server.mail.send.SmtpEmailSender.send(SmtpEmailSender.java:207)
at com.google.gerrit.server.mail.send.OutgoingEmail.send(OutgoingEmail.java:225)
at com.google.gerrit.server.restapi.account.CreateEmail.apply(CreateEmail.java:164)
at com.google.gerrit.server.restapi.account.CreateEmail.apply(CreateEmail.java:121)
at com.google.gerrit.server.restapi.account.CreateEmail.apply(CreateEmail.java:71)
Is this related to this question on the mailing list?
Also, when I check the office365 smtp settings it looks like it should use tls instead of ssl:
SMTP Host: smtp.office365.com
SMTP Port: 587
SSL Protocol: OFF
TLS Protocol: ON
SMTP Username: (your Office365 username)
SMTP Password: (your Office365 password)
Try to change your settings to tls and maybe you need to implement the workaround for java11.
1 more tip when I come back to this 3 years later...
I met another problem with similar phenominal.
It turns out some mail server requires the field 'from' must be equal to 'smtpUser'.
We have a GITLAB setup and
We want to send the output of a error file as a attachment and giving a proper message including in the body as a mail notification to the recipients using BLAT as a service. Using below code
blat -subject "IP is not pingable" -body "please check the attachment for the error logs" -attach C:\Temp\error.txt -to santoshkumar.angadi#yahoo.com
We want to send this from the GITLAB. But I am getting BLAT error log as :
Error: Not a socket for a SMTP server. How to achieve this
Specify an SMTP server with the -server <address>
See http://www.blat.net/syntax/server.html
Make sure it's one that blat can connect to.
As http://www.blat.net/?docs/readme.txt says: To use Blat you must have access to a SMTP server via TCP-IP
I am trying to configure email but getting following error.
when running task getting following error: -
I am using Python3 with airflow 10.3 versions in GCP Composer need help.
My airflow.cfg
[email]
email_backend = airflow.contrib.utils.sendgrid.send_email
[smtp]
smtp_host = smtp.gmail.com
smtp_starttls = True
smtp_ssl = False
smtp_user = airflow
smtp_port = 587
smtp_password = mypassword
smtp_mail_from = myemail#gamil.com
in my dag file I have created task :-
dag.py file:-
from airflow.operators.email_operator import EmailOperator
email_task=EmailOperator(task_id='email_task',to="email#gamil.com", subject="test", html_content="<h1>Most important heading here</h1>", files=None, cc=None, bcc=None, mime_subtype='mixed', mime_charset='us_ascii', dag=dag)
Getting error:
ERROR - HTTP Error 401: Unauthorized
python_http_client.exceptions.UnauthorizedError: HTTP Error 401: Unauthorize
The error is an Authorization error, so you need to check that you're setting your Sendgrid API Key (or password, if using a smtp-server) correctly.
Based on your airflow.cfg, it seems to me that you are trying to use both Sendgrid and a third-party smtp server.
The email flag determines which one to use. In this case, the flag email_backend = airflow.contrib.utils.sendgrid.send_email is specifying that you are going to use Sendgrid.
To configure Sendgrid as your email server, you need to obtain your SENDGRID_API_KEY and set both the key and SENDGRID_MAIL_FROM as environment variables.
On the other hand, if you want to use another smtp server, you have to change the email flag to email_backend = airflow.utils.email.send_email_smtp. In this case, you need to override the smtp user and password.
With Google Cloud Composer, you must set the:
SENDGRID_MAIL_FROM
and the:
SENDGRID_API_KEY
Composer "ENVIRONMENT VARIABLES"
I'm trying to send an email using smtp-relay.gmail.com as a relay server, but when I try to use the 'Mail From:' command, I get this error:
c: mail from: username#google.com
s: 555 5.5.2 Syntax error. f23sm825435wmf.2 - gsmtp
use brackets <> (some mail servers does not require this)
MAIL FROM: <user#example.com>
I am getting below error while sending a mail from Email subscription in SSRS.
Below is the Configuration section:
<RSEmailDPConfiguration>
<SMTPServer>mysmtpserver addres</SMTPServer>
<SMTPServerPort>
</SMTPServerPort>
<SMTPAccountName>
</SMTPAccountName>
<SMTPConnectionTimeout>
</SMTPConnectionTimeout>
<SMTPServerPickupDirectory>
</SMTPServerPickupDirectory>
<SMTPUseSSL>
</SMTPUseSSL>
<SendUsing>2</SendUsing>
<SMTPAuthenticate>2
</SMTPAuthenticate>
<From>myid#domain.com</From>
<EmbeddedRenderFormats>
<RenderingExtension>MHTML</RenderingExtension>
</EmbeddedRenderFormats>
<PrivilegedUserRenderFormats>
</PrivilegedUserRenderFormats>
<ExcludedRenderFormats>
<RenderingExtension>HTMLOWC</RenderingExtension>
<RenderingExtension>NULL</RenderingExtension>
<RenderingExtension>RGDI</RenderingExtension>
</ExcludedRenderFormats>
<SendEmailToUserAlias>True</SendEmailToUserAlias>
<DefaultHostName>
</DefaultHostName>
<PermittedHosts>
</PermittedHosts>
</RSEmailDPConfiguration>
Error:
notification!WindowsService_0!1858!08/20/2013-05:48:02:: i INFO: Handling subscription f78a80f1-dd72-4215-b86a-96fa7391cfc0 to report ReportMenu, owner: mydomain\myid, delivery extension: Report Server Email.
library!WindowsService_0!1858!08/20/2013-05:48:02:: i INFO: RenderForNewSession('/ReportProject/ReportMenu')
library!WindowsService_0!1858!08/20/2013-05:48:04:: i INFO: Initializing EnableExecutionLogging to 'True' as specified in Server system properties.
emailextension!WindowsService_0!1858!08/20/2013-05:48:04:: e ERROR: Error sending email. Exception: System.Net.Mail.SmtpException: Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender
at System.Net.Mail.DataStopCommand.CheckResponse(SmtpStatusCode statusCode, String serverResponse)
at System.Net.Mail.SmtpConnection.OnClose(Object sender, EventArgs args)
at System.Net.ClosableStream.Close()
at System.Net.Mail.MailWriter.Close()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at Microsoft.ReportingServices.EmailDeliveryProvider.EmailProvider.Deliver(Notification notification)
notification!WindowsService_0!1858!08/20/2013-05:48:04:: i INFO: Notification f06badda-98db-4aba-8a1f-26646430479b completed. Success: True, Status: Failure sending mail: Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender, DeliveryExtension: Report Server Email, Report: ReportMenu, Attempt 0
Could someone help on this ?
As per the exception, the issue is coming from the SMTP server:
Status: Failure sending mail: Mailbox unavailable. The server response
was: 5.7.1 Client does not have permissions to send as this sender
Because you have SMTPAuthenticate set to 2 in the config, the SSRS service user will try and authenticate to the SMTP server. See Configure a Report Server for E-Mail Delivery for more details.
You need to resolve this issue - since SSRS is running under NT Service\ReportServer and trying to send the mail as <From>myid#domain.com</From> the SMTP server will not allow this, and hence the error.
As a test you can change the SSRS service user to myid#domain.com as a check to confirm this is the issue.
If so, you should investigate getting a domain user set up with a mailbox and running the SSRS service under that user.
Your other option is removing the Authentication option from the config (i.e. setting SMTPAuthenticate to 0) and allowing anonymous authentication to the SMTP server, though this might not be allowed in your environment.