Search
 
SCRIPT & CODE EXAMPLE
 

PHP

send email in php

<?php
    ini_set( 'display_errors', 1 );
    error_reporting( E_ALL );
    $from = "test@hostinger-tutorials.com";
    $to = "test@hostinger.com";
    $subject = "Checking PHP mail";
    $message = "PHP mail works just fine";
    $headers = "From:" . $from;
    if(mail($to,$subject,$message, $headers)) {
		echo "The email message was sent.";
    } else {
    	echo "The email message was not sent.";
    }
Comment

send-email.php

<?php

$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$message = $_POST["message"];

require "vendor/autoload.php";

use PHPMailerPHPMailerPHPMailer;
use PHPMailerPHPMailerSMTP;

$mail = new PHPMailer(true);

// $mail->SMTPDebug = SMTP::DEBUG_SERVER;

$mail->isSMTP();
$mail->SMTPAuth = true;

$mail->Host = "smtp.example.com";
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;

$mail->Username = "you@example.com";
$mail->Password = "password";

$mail->setFrom($email, $name);
$mail->addAddress("dave@example.com", "Dave");

$mail->Subject = $subject;
$mail->Body = $message;

$mail->send();

header("Location: sent.html");
Comment

create an email addresses php

//Using Cpanel from StackOverflow
$socket = fsockopen($cpdomain,2082);
$cuser = "YourUserName";
$cpassword = "YourPassword";
$authstr = base64_encode("".$cpuser.":".$cppass."");
$in = "GET /frontend/$cpskin/mail/doaddpop.html?email=$euser&$edomain&password=$epass&quota=$equota
HTTP/1.0
Authorization: Basic $authstr 
";
fputs($socket,$in);
fclose( $socket );
Comment

php email

mail ( string $to , string $subject , string $message [, mixed $additional_headers [, string $additional_parameters ]] ) : bool
Comment

read an email with php

//docs
https://www.php.net/manual/en/book.imap.php

https://garrettstjohn.com/articles/reading-email-php/
Comment

PREVIOUS NEXT
Code Example
Php :: prestashop get product id 
Php :: php polymorphism 
Php :: apache/2.4.52 (win64) openssl/1.1.1m php/8.1.2 server at localhost port 80 
Php :: php trait 
Php :: laravel verification email 
Php :: php stristr 
Php :: laravel data type 
Php :: how to print any string in double quotes in php 
Php :: how use variable in string in laravel 
Php :: strings functions php 
Php :: how to create php message 1 
Php :: laravel display multiple selected values 
Php :: wpdb count 
Php :: schema add column laravel 
Php :: php login system 
Java :: how to detect operating system in java 
Java :: android glide dependency 
Java :: android copy text to clipboard programmatically 
Java :: javafx dependency 
Java :: how to get that 1600 sat 
Java :: creating random color in java 
Java :: java try catch integer.parseint 
Java :: gradle springboot run 
Java :: get number of lines in a file java 
Java :: android essential plugin missing 
Java :: servlet redirect java 
Java :: how to check if location is enabled android 
Java :: Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules jetified-guava-24.1-jre (com.google.guava:guava:24.1-jre) and jetified-listenablefuture-1.0 (com.google.guava:listenablefuture:1.0) 
Java :: for loop in multidimensional array java 
Java :: java split first occurrence 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =