Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7805955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:22:40+00:00 2026-06-02T02:22:40+00:00

good evening everone , i have phpmailer code which allow me to connect to

  • 0

good evening everone , i have phpmailer code which allow me to connect to smtp google service and send a message through it , here is the code

 <?php 
require_once("class.phpmailer.php");
include("class.smtp.php"); 
$sname="=?UTF-8?B?".base64_encode($sname)."?=\n";
$smail=""; 
$rname="=?UTF-8?B?".base64_encode($rname)."?=\n"; 
$rmail="";
$sub="=?UTF-8?B?".base64_encode($sub)."?=\n"; 
$body=$n;   
$sname=$_POST['element_2'];
$n= $_POST['element_1'] . $_POST['element_3'];
$mail = new PHPMailer();
$mail->IsSMTP(); 
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$gmail="account@gmail.com";
$gpass="password";
$mail->Username = $gmail; 
$mail->Password = $gpass; 
$mail->AddReplyTo($smail,$sname); 
$rmail = "receive@hotmail.com";
$rname="me";
$mail->AddAddress($rmail, $rname); 
$mail->From = $smail; 
$mail->FromName = $sname;
$mail->Subject = $sub; 
$mail->MsgHTML($body); 
$mail->IsHTML(true); 
if(!$mail->Send()) {
echo "fail";
}else{
echo "success";
}
?>

the problem is , i can’t get the name of the sender
i ‘ve tried to insert it into body but it couldn’t success

$n= $_POST['element_1'] . $_POST['element_3'];

my 2nd issue is
i have also a 3 radio buttons for the subject , i’ve used

if(isset($_POST['radio1'])){
$sub = "free";
}
if(isset($_POST['radio2'])){
$sub = "premium";
}

but still receive empty subject
could you please help me
thanks in advance


thanks for your time , me first issue was solved ,
thanks to you ,
but the second one unfortunately didn’t. i’ve gave radio buttons the same name and change their value as following

<input id="element_4_1" name="element_4" class="element radio" type="radio" value="free" />
<input id="element_4_1" name="element_4" class="element radio" type="radio" value="premium" />

when i select a radio button it suppose to have the value free or premium but it have the value 1
i tried your code (i’ve put it right under $n value )

$sub = isset($_POST['element_4']) ? $_POST['element_4'] : "no subject";

and tried this

$sub = $_POST['element_4'];

but it didn’t work
could you goon with your help please
thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T02:22:42+00:00Added an answer on June 2, 2026 at 2:22 am

    put

    $body=$n;   
    

    after

    $n= $_POST['element_1'] . $_POST['element_3'];
    

    it works if in fact $_POST['element_1'] and $_POST['element_3'] are being posted to this page !

    and as for your radio buttons
    all of them should have the same name and there values should be the subject of your email

    $sub = isset($_POST['radio']) ? $_POST['radio'] : "no subject";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good evening, I have been trying to wrap my head about this, below, code
Good evening :-)! I have this code to use Drag & Drop method for
Good evening, In my app that I'm currently developing, I have a class that
Good evening. For a project, I have to create a system. In this system,
Good evening guys, I'm trying to pass multiple checkbox values through AJAX and process
Good evening, i need to know how can i have one .h file that
Good evening I have a JTable that I built with a TableModel how to
Good evening everyone, I have a quick question on a homework assignment my class
Good evening all! i have an Ajax call that loads 5 'echo's' from a
Good evening,someone asked me to help her with fixing some code for asp.net, she

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.