Starttls command first php

WampServer: Предупреждение: mail (): SMTP-ответ сервера: 530 5.7.0 Сначала необходимо выполнить команду STARTTLS.

У меня возникла проблема с WampServer, я пытался создать контактную форму, но она не работает. BIOS перестала распознавать мой 2 ГБ ОЗУ, поэтому моя система считает, что она 32-разрядная, а не 64-разрядная. Вот таблица ошибок PHP:

( ! ) Warning: mail(): SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. 8sm9902426ioe.8 - gsmtp in C:\Users\miner\Desktop\Configuration Creator\www\contact\mail.php on line 10 Call Stack # Time Memory Function Location 1 0.0004 245672 ( ) ..\mail.php:0 2 0.0004 246648 mail ( ) ..\mail.php:10 
Your message has been sent!

'; > else < echo '

Something went wrong. Please manually email me and include a screenshot/copy of the log above.

'; > ?>
[mail function] ; For Win32 only. ; http://php.net/smtp SMTP = smtp.gmail.com ; http://php.net/smtp-port smtp_port = 587 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = email@example.com 

Извините, если это дубликат, моя проблема отличается от других.

Решение

; http://php.net/smtp SMTP = smtp.gmail.com ; http://php.net/smtp-port smtp_port = 587 
; http://php.net/smtp SMTP = ssl://smtp.gmail.com ; http://php.net/smtp-port smtp_port = 465 
; http://php.net/smtp SMTP = tls://smtp.gmail.com ; http://php.net/smtp-port smtp_port = 587 

Один из моих вариантов должен быть в порядке для вас.

Но я не рекомендую использовать функцию mail () тем более с Wamp (сокеты будут хорошим решением).

Вы действительно используете smtp-сервис Gmail с mail () или вы публикуете Gmail только для примера? Для использования smtp-сервиса Gmail вам нужна аутентификация (пароль + имя пользователя), но функция mail () не поддерживает ее. Вам необходимо написать персональную почтовую функцию на основе сокетов или использовать готовые решения, такие как hMailServer, и отправлять почту с помощью этого программного обеспечения (кредитные изображения hMailServer должны быть записаны в php.ini).

Читайте также:  Htaccess открывать index html

Другие решения

Источник

Failed to send mail via php, must issue a STARTTLS command first

Question: I’m trying to send a mail using javamail api using the below code: when I compile the class file I’m getting the below error which says ‘must issue starttls command first’ I have mentioned the error below. Solution: From the error message, it sounds like the mail server that you are trying to send this message through is requiring STARTTLS on the connection.

Failed to send mail via php, must issue a STARTTLS command first

I’m trying to send a local mail but it always generates this error: Must issue a STARTTLS command first. I tried to find solution and I found this website which show how to configure PHP under windows to use gmail or external STMP server and I followed each step but it always generates the same error. I lost my way!!

Is there anyone who had encounter this problem before? I’m gratefull for your help.

From the error message, it sounds like the mail server that you are trying to send this message through is requiring STARTTLS on the connection. STARTTLS is a type off connection that initially starts of unencrypted, then switches to an encrypted mode during the connection. If your PHP script that is sending the message does not support STARTTLS, and the mail server that you are trying to send the message through requires STARTTLS, then you will get this error.

To solve the problem, you can do one of the following:

1) Program your PHP script to connect to the mail server using a STARTTLS type of connection. I’m not sure if you are using PHPMailer, but if you are, PHPMailer supports STARTTLS (set the SMTPSecure property to ‘tls’).

2) Check if the mail server that you are trying to send through allows a different type connection (e.g. plaintext or SSL) on a different port. If so, you can change your PHP script to connect using that type of connection on that port.

STARTTLS error while sending email using Indy in Delphi, **ERROR: Must issue a STARTTLS command first. i29sm34080394wbp.22** How can I solve this? delphi delphi-xe indy10. Share. Follow edited Jan 18, 2013 at 19:39. james.garriss it just does not support the STARTTLS command that GMail’s SMTP server requires. You can send the …

Send-MailMessage not working

I am using the send-MailMessage cmdlet in PowerShell version 2 and it gives me a error.

I tried using all the options which were mentioned in the earlier posts and it didn’t help me.

This is the command that I am using:

send-MailMessage -from "abc@gmail.com" -to "def@gmail.com" -subject "test" -body"test" -smtp "smtp.gmail.com" 

send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated
e was: 5.7.0 Must issue a STARTTLS command first. l46sm12283804qgd.27 — gsmtp
At line:1 char:17
+ send-MailMessage credential abc
+ CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Se
ion
+ FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage

I tried using UseSsl= true and also by giving credentials and even then I was not able to send email. Could you let me know what I am missing here?

In order to use gmail you need SSL, I’am not sure you can use Send-MailMessage try this :

$emailSmtpServer = "smtp.gmail.com" $emailSmtpServerPort = "587" $emailSmtpUser = "yourlogin@gmail.com" $emailSmtpPass = "yourPassword" $emailMessage = New-Object System.Net.Mail.MailMessage $emailMessage.From = "yourlogin@gmail.com" $emailMessage.To.Add("YourSendTo@mail.com") $emailMessage.Subject = "Small mail for a friend" $emailMessage.IsBodyHtml = $true $emailMessage.Body = @" 

Hello me.

It seems to work

JP

"@ $SMTPClient = New-Object System.Net.Mail.SmtpClient( $emailSmtpServer , $emailSmtpServerPort ) $SMTPClient.EnableSsl = $true $SMTPClient.Credentials = New-Object System.Net.NetworkCredential( $emailSmtpUser , $emailSmtpPass ); $SMTPClient.Send( $emailMessage )

To use mail attachment please have a look Sytem.Net.Mail.MailMessage documentation. You need first to create an Attachment and then to add it to the MailMessage Attacments collection.

For those that come later, here is my two liner example, for the account «gmail-user@gmail.com». This can be scheduled.

$credentials = new-object Management.Automation.PSCredential “gmail-user@gmail.com”, (“gmail-user's password” | ConvertTo-SecureString -AsPlainText -Force) Send-MailMessage -From "gmail-user@gmail.com" -to "someone-else@gmail.com" -Subject "Some subject" -Body "Some body" -SmtpServer "smtp.gmail.com" -port 587 -UseSsl -Credential $credentials -Attachments "C:\an-attachment.txt" 

5.7.0 Must issue a STARTTLS command first, 7.0 Must issue a STARTTLS command first. sv10sm1163889lab.14. I get this message when trying to send a message on Outlook in Office for Mac. «5.7.0 Must issue a STARTTLS command first. sv10sm1163889lab.14». I can’t send messages although I receive.

Telnet smtp.mail — must issue STARTTLS command first

On my Mac terminal, I am trying to telnet into my smtp.gmail.com through port 587 .

On Google Apps, (which is set to manage a Dreamhost domain), I have relay configured, as follows:

«Allowed senders: Only addresses in my domains» «Require SMTP Authentication: Yes «

250 smtp.gmail.com at your service

530 5.7.0 Must issue a STARTTLS command first.

You’re required to start encrypting the connection first. This is done using the STARTTLS command.

You can use the following command instead of telnet :

openssl s_client -starttls smtp -ign_eof -crlf -connect smtp.gmail.com:587

It works like the telnet command, but takes care of starting the encryption first.

Smtp — getting «530 5.7.0 Must issue a STARTTLS, build.xml Failed to send email: 530 5.7.0 Must issue a STARTTLS command first. Related. 405. Send email using the GMail SMTP server from a PHP page. 22. SMTP server response: 530 5.7.0 Must issue a STARTTLS command first. 0. Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a …

Javamail error: must issue starttls command first

I’m trying to send a mail using javamail api using the below code: when I compile the class file I’m getting the below error which says ‘must issue starttls command first’ I have mentioned the error below. And also getProvider() function error I think so. I don’ t know what the errors mean.

import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import javax.mail.*; import javax.mail.internet.*; import javax.mail.event.*; import javax.mail.Authenticator; import java.net.*; import java.util.Properties; public class mailexample < public static void main (String args[]) throws Exception < String from = args[0]; String to = args[1]; try < Properties props=new Properties(); props.put("mail.transport.protocol", "smtp"); props.put("mail.smtp.host","smtp.gmail.com"); props.put("mail.smtp.port", "25"); props.put("mail.smtp.auth", "true"); javax.mail.Authenticator authenticator = new javax.mail.Authenticator() < protected javax.mail.PasswordAuthentication getPasswordAuthentication() < return new javax.mail.PasswordAuthentication("123@gmail.com", "pass"); >>; Session sess=Session.getDefaultInstance(props,authenticator); sess.setDebug (true); Transport transport =sess.getTransport ("smtp"); Message msg=new MimeMessage(sess); msg.setFrom(new InternetAddress(from)); msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); msg.setSubject("Hello JavaMail"); msg.setText("Welcome to JavaMail"); transport.connect(); transport.send(msg); > catch(Exception e) < System.out.println("err"+e); >> > 
C:\Users\bobby\Desktop>java mailexample abc@gmail.com abc@gmail. com DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.s mtp.SMTPTransport,Sun Microsystems, Inc] DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: useEhlo true, useAuth true DEBUG: SMTPTransport trying to connect to host "smtp.gmail.com", port 25 DEBUG SMTP RCVD: 220 mx.google.com ESMTP q10sm12956046rvp.20 DEBUG: SMTPTransport connected to host "smtp.gmail.com", port: 25 DEBUG SMTP SENT: EHLO bobby-PC DEBUG SMTP RCVD: 250-mx.google.com at your service, [60.243.184.29] 250-SIZE 35651584 250-8BITMIME 250-STARTTLS 250 ENHANCEDSTATUSCODES DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.s mtp.SMTPTransport,Sun Microsystems, Inc] DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: useEhlo true, useAuth true DEBUG: SMTPTransport trying to connect to host "smtp.gmail.com", port 25 DEBUG SMTP RCVD: 220 mx.google.com ESMTP l29sm12930755rvb.16 DEBUG: SMTPTransport connected to host "smtp.gmail.com", port: 25 DEBUG SMTP SENT: EHLO bobby-PC DEBUG SMTP RCVD: 250-mx.google.com at your service, [60.243.184.29] 250-SIZE 35651584 250-8BITMIME 250-STARTTLS 250 ENHANCEDSTATUSCODES DEBUG SMTP SENT: MAIL FROM: DEBUG SMTP RCVD: 530 5.7.0 Must issue a STARTTLS command first. l29sm12930755rvb .16 DEBUG SMTP SENT: QUIT errjavax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command f irst. l29sm12930755rvb.16

Probably, you need to put props.put(«mail.smtp.starttls.enable»,»true»); before you authenticate.

This code seems to work fine using the Gmail SMTP server to send emails. Note — This does not have an attachment.

(Source : Modified from the example on https://forums.oracle.com/forums/thread.jspa?threadID=1587188)

package org.ssb.mail; import java.util.Date; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class MailClient < /** * Entry method * * @param args * String[] */ public static void main(String[] args) < MailClient client = new MailClient(); try < client.sendMail(); >catch (AddressException ae) < ae.printStackTrace(); >catch (MessagingException me) < me.printStackTrace(); >> /** * Sends an email * * @param none */ private void sendMail() throws AddressException, MessagingException < // Get a Properties object Properties props = System.getProperties(); // ******************** FOR PROXY ****************** // props.setProperty("proxySet","true"); // props.setProperty("socksProxyHost","9.10.11.12"); // props.setProperty("socksProxyPort","80"); // props.setProperty("socksProxyVersion","5"); props.setProperty("mail.smtp.host", "smtp.gmail.com"); // ******************** FOR SSL ****************** //final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; //props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY); //props.setProperty("mail.smtp.socketFactory.fallback", "false"); //props.setProperty("mail.smtp.port", "465"); //props.setProperty("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.auth", "true"); props.put("mail.debug", "true"); props.put("mail.store.protocol", "pop3"); props.put("mail.transport.protocol", "smtp"); final String username = "sender-username"; final String password = "sender-password"; Session session = Session.getDefaultInstance(props, new Authenticator() < protected PasswordAuthentication getPasswordAuthentication() < return new PasswordAuthentication(username, password); >>); // -- Create a new message -- Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress("sender@gmail.com")); msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("recipient@yahoo.com", false)); msg.setSubject("Hello"); msg.setSentDate(new Date()); // **************** Without Attachments ****************** msg.setText("How are you"); Transport.send(msg); System.out.println("Message sent."); > > 

I had the same problem as you described. In my case, replacing

Session session = Session.getDefaultInstance(props);

Session session = Session.getInstance(props);

did the trick. I hope it will be helpful.

This work for me. Set the following tags. It will work.

props.put("mail.smtp.user","username"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "25"); props.put("mail.debug", "true"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable","true"); props.put("mail.smtp.EnableSSL.enable","true"); props.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.setProperty("mail.smtp.socketFactory.fallback", "false"); props.setProperty("mail.smtp.port", "465"); props.setProperty("mail.smtp.socketFactory.port", "465"); 

Ruby on rails — Getting «Must issue a STARTTLS, Must issue a STARTTLS command first Others seem to have encountered this same problem: The problem is that Gmail requires TLS authentication but the standard Ruby net/smtp library doesn’t support TLS. The article recommends following these steps, which I did:

Источник

Оцените статью