Fix: 504 5.5.2 <localhost>: Helo command rejected
This commit is contained in:
		
					parent
					
						
							
								be19fe48d7
							
						
					
				
			
			
				commit
				
					
						5293ae1221
					
				
			
		
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -10,6 +10,7 @@ import (
 | 
			
		|||
	"net"
 | 
			
		||||
	"net/mail"
 | 
			
		||||
	"net/smtp"
 | 
			
		||||
	"os"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"github.com/gogits/gogs/modules/log"
 | 
			
		||||
| 
						 | 
				
			
			@ -95,6 +96,12 @@ func sendMail(settings *setting.Mailer, recipients []string, msgContent []byte)
 | 
			
		|||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	hostname, err := os.Hostname()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	client.Hello(hostname)
 | 
			
		||||
 | 
			
		||||
	// If not using SMTPS, alway use STARTTLS if available
 | 
			
		||||
	hasStartTLS, _ := client.Extension("STARTTLS")
 | 
			
		||||
	if !isSecureConn && hasStartTLS {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue