STARTTLS error when sending mail through XAMPP - email

I'm working on a website that has a form which sends an email upon submission using XAMPP. Unfortunately I can't seem to get rid of the error
Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. g20-20020a17090a7d1400b001fd674057d2sm3458984pjl.48 - gsmtp in C:\xampp\htdocs\contact.php on line 25
here are my ini files
php.ini
[mail function]
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = ***#gmail.com
;sendmail_path =
;mail.force_extra_parameters =
mail.add_x_header=Off
mail.log = "C:\xampp\mailoutput\mail.log"
sendmail.ini
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=tls
;default_domain=mydomain.com
error_logfile=error.log
;debug_logfile=debug.log
auth_username=***#gmail.com
auth_password=***
pop3_server=pop.gmail.com
pop3_username=***#gmail
pop3_password=***
force_sender=***#gmail.com
force_recipient=
hostname=smtp.gmail.com
I've tried changing SMTP to tls://smtp.gmail.com which threw an error that it couldnt connect, then I tried ssl://smtp.gmail.com and changed the port to 465 and I got the same error. Any help would be greatly appreciated, thank you very much!

So I fixed it by changing sendmail_path to
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" which got rid of the warning. Unfortunately though I can't find the email anywhere in my inbox. Any help with this would be appreciated!

Related

com.sun.mail.smtp.SMTPSendFailedException: 550 Access denied

I am trying since yesterday but no luck. I am getting this weird error message which doesn't have much information or solution on the Internet.
A problem occurred when attempting to deliver mail.
This exception was caused by:
com.sun.mail.smtp.SMTPSendFailedException: 550 Access denied - Invalid
HELO name (See RFC2821 4.1.1.1) ; nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 550 Access denied -
Invalid HELO name (See RFC2821 4.1.1.1) .
Code that sends email via SMTP
<cfmail
from="no-reply#example.com"
server="mail.example.com"
to="example#gmail.com"
username="no-reply#example.com"
password="password"
port=587
subject="ColdFusion Email">ColdFusion</cfmail>
I use the same server, username and password on our PHP websites using PHPMailer everything works fine only on ColdFusion websites am getting this error.
Please advise

Bugzilla - Email not working

I have installed Bugzilla-4.4 in my new Ubuntu Machine. When I submit a new bug, I got the email sent notification. But the sent email is not received by the recipients . I am using Sendmail mail configuration in Bugzilla. I have also tested "Test" mail configuration in which the mail is logged in bugzilla-4.4/data/mailer.testfile successfully. When I check my mail.log file I found the following:
(1001/1001), delay=3+15:58:59, xdelay=00:00:00, mailer=esmtp, pri=47643784, relay=mailrelay.netcon.in., dsn=4.0.0, stat=Deferred: Connection timed out with mailrelay.netcon.in.
I have no idea what to do.Is anything I missed out while Sendmail configuration? Any help!!
Try nc from command line:
nc mailrelay.netcon.in 25
which should result in something like:
220 mailrelay.netcon.in ESMTP Postfix
If not check for internet connection and/or router firewall rules.

SMTP authentication failure while using SendGrid/Gmail

I am getting SMTP Authentication Failure on the server and the mail is getting send via the server SMTP only...
It appears to be a server configuration or related problem, but I am not sure.
This is the debug details:
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
Failed to authenticate password. Error: 535 Incorrect authentication data
from: 250 OK
to: 250 Accepted
data: 354 Enter message, ending with "." on a line by itself
250 OK id=1U8Pjp-0002As-FB
quit: 221 ************** closing connection
Your message has been successfully sent using the following protocol: smtp
While testing from my local system, this works and the email is being sent via sendgrid.me
Again, This may not be a SendGrid Problem, but if you have faced similar issue, Can you please tell me what is the problem here?
I am using CentOs and I have cPanel in the server. I believe we are using EXIM for mail server.
For anyone that comes across this in future and are using cpanel/whm, you need to 'disable' this option under 'SMTP Restrictions' in WHM.
I was able to resolve this.
The issue was my server was not allowing the use of external SMTP and using its own SMTP server. I changed the settings and now it works fine.
I am using centos 7 Finally it works!
I was getting this issue(tail -f /var/log/mailog):
to=<usmanali#example.com>, relay=smtp.sendgrid.net[169.45.113.201]:587, delay=0.3, delays=0.05/0.07/0.16/0.02, dsn=5.0.0, status=bounced (host smtp.sendgrid.net[169.45.113.201] said: 550 Unauthenticated senders not allowed (in reply to MAIL FROM command))
Then i changed file /etc/postfix/main.cf in this way that added following lines into end of file
mtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
mailbox_size_limit = 256000000
# Sendgrid Settings
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:apikey:SG.YOUR_SENDGRID_KEY
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587
Then Installing postfix missing module dependency using:
sudo yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain
Then restarting postfix
sudo systemctl restart postfix.service

Warning: mail(mail.log): failed to open stream: Permission denied in

I am trying to use the function mail in a server over windows with iss7 and i am getting this warning which doesn't let me send mails:
Warning: mail(mail.log): failed to open stream: Permission denied in xxxx
That line is:
mail("mail#myserver.com", "subject", 'body',"From: mail2#myserver.com")
At php.ini i have configured SMTP server, port and sendmail_from like this:
; http://php.net/smtp
SMTP = 128.x.x.xxx
; http://php.net/smtp-port
smtp_port = 110
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = mymail#myserver.com
; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
mail.log = mail.log
I have also created a file called "mail.log" inside C:/php/ and i have changed permissions to write and read for all users.
Also, at phpinfo() safe_mode is Off.
I am currently sending mails with PHPMailer but it is soooo slow that i want to try it with mail function.
Do you know what am I doing wrong?
Thanks.
You should have a mail.log entry in your php.ini file which should log all the mail() function calls. Search for it and if you don't have this line, then it's taking some strange default or previously defined value, so you better define it and point it to the file you have created in your PHP folder and hopefully assigned good permissions to. For more check what phpinfo() is saying about mail.log.
For more info: mail configuration.

Mew gives SMTP error when trying to send through GMail

I'm trying to send an email using the GMail SMTP server.
I have the following setup for mew in emacs:
(default
(mailbox-type 'imap)
(proto "%")
(imap-user my-email)
(imap-server "imap.gmail.com")
(imap-ssl t)
(smtp-server "smtp.gmail.com")
(smtp-auth-list ("PLAIN" "LOGIN" "CRAM-MD5"))
(smtp-user my-email)
(user my-username)
(mail-domain "gmail.com")
(name my-name)
(imap-friend-folder "%from")
(imap-trash-folder "%[Gmail]/All Mail"))
I'm not sure what I'm doing wrong.
The error message is this: 530 5.7.0 Must issue a STARTTLS command first. dr7sm13115113qab.26. This mail has been queued to +queue
What mew configuration settings do I have to change to make this problem go away?
Looks like I forgot to set the variable smtp-ssl to t so that the SMTP connection uses SSL (which GMail requires).