Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- Session
- 전략
- jquery
- function
- file-upload
- MySQL
- OOP
- 무료다운로드쿠폰
- Apache
- Arrays
- variables
- UTF-8
- Forms
- 경영
- 웹하드추천
- string
- Laravel
- composer-php
- JavaScript
- Regex
- Linux
- JSON
- date
- curl
- HTML
- Ajax
- 웹하드순위
- post
- php
Archives
- Today
- Total
개발! 딱 깔끔하고 센스있게!
PHP Mailer 와 GMAIL SMTP 를 사용 하여 메 일 을 보 냅 니 다. 본문
나 는 인터넷 의 모든 예 를 읽 었 지만, 여전히 GMAIL SMTP 에 연결 할 수 없 는 것 같다.
다음은 제 가 운영 하 는 코드 입 니 다:
include("phpMailer/class.phpmailer.php"); // path to the PHPMailer class $mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "myUsername"; // SMTP username $mail->Password = "myPassword"; // SMTP password $mail->SMTPDebug = 1; $webmaster_email = "[email protected]"; //Reply to this email ID $email="[email protected]"; // Recipients email ID $name="SomeonesName"; // Recipient's name $mail->From = $webmaster_email; $mail->FromName = "Me"; $mail->AddAddress($email,$name); $mail->AddReplyTo($webmaster_email,"Webmaster"); $mail->WordWrap = 50; // set word wrap $mail->IsHTML(true); // send as HTML $mail->Subject = "This is the subject"; $mail->Body = "Hi, This is the HTML BODY "; //HTML Body $mail->AltBody = "This is the body when user views in plain text format"; //Text Body if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent"; }
포트 를 설치 하려 고 합 니 다.
class. smtp. phop 파일 에 현재 포트 도 설치 하 였 습 니 다:
$host = "ssl://smtp.gmail.com"; $port = 465;
저 는 항상 같은 실 수 를 받 고 있 습 니 다.
ssl 을 사용 할 것 을 확 보 했 습 니 다.
내 가 얻 은 잘못 은:
SMTP -> ERROR: Failed to connect to server: No connection could be made because the target machine actively refused it.(10061)
대답 하 다.
앞서 언급 한 바 와 같이 저 는 pm openssl. dll 에서 제거 하고 Apache 를 다시 시작 하여 ssl 을 사용 하 게 되 었 습 니 다.
내 가 더 많이 읽 었 더 니 어떤 사람들 은 명령 을 쓰기 전에 '[PHP OPENSSL]' 이 있 더 라.나 는 그것 을 추가 하고 다시 아파 치 를 시작 했다.
모든 것 이 정상!댓 글 감사합니다.
p. ini 에서:
[PHP_OPENSSL] extension=php_openssl.dll
'개발 스크랩 메모 > PHP' 카테고리의 다른 글
XML 데 이 터 를 PHP 변수 로 분석 하 는 방법 (0) | 2020.12.02 |
---|---|
PHP 로 만 든 트랙 과 맞 먹 는 것 이 있 습 니까?[종료] (0) | 2020.12.02 |
PHP 에 들 어 있 는 폐쇄... 정확히 말 하면 그것들 은 무엇 입 니까? 언제 사용 해 야 합 니까? (0) | 2020.12.02 |
PHP: 클래스 를 재 확인 할 수 없습니다. (0) | 2020.12.02 |
PHP 시작: 모듈 을 초기 화 할 수 없습니다. (0) | 2020.12.02 |
Comments