Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not sending email when subject has first and last name in it #3049

Closed
6 tasks
RaviWeb105 opened this issue Apr 10, 2024 · 7 comments
Closed
6 tasks

Not sending email when subject has first and last name in it #3049

RaviWeb105 opened this issue Apr 10, 2024 · 7 comments

Comments

@RaviWeb105
Copy link

RaviWeb105 commented Apr 10, 2024

Please check these things before submitting your issue:

  • Read the error message you're seeing - it often tells you what is wrong, and may contain useful links & instructions
  • Make sure you're using the latest version of PHPMailer
  • Check that your problem is not dealt with in the troubleshooting guide, especially if you're having problems connecting to Gmail or GoDaddy
  • Include sufficient code to reproduce your problem
  • If you're having an SMTP issue, include the debug output generated with SMTPDebug = 2 set
  • If you have a question about how to use PHPMailer (rather than reporting a bug in it), tag a question on Stack Overflow with phpmailer, but search first!

Problem description

->when sending email with the name as "Ravi a" the email is not sending ,when sending with "Ravi" email Is sent
not accepting the space in name variable which we get from post request

Code to reproduce

   $name = $_POST['name'];
$subject = 'Hello '.$name.'! Welcome to  Habits!';
       

            $message = '<message body in here>';
   $mail = new PHPMailer\PHPMailer\PHPMailer();
            $mail->IsSMTP();
            $mail->CharSet = 'UTF-8';
            $mail->SMTPDebug = 2;
            $mail->SMTPAuth = true;
            $mail->Host = "host_name";
            $mail->Port = "465";
            $mail->Username = $from;
            $mail->Password = $pass;
            $mail->SMTPSecure = "ssl";
            $mail->From = $from;
            $mail->FromName = "new Apps";
            $mail->AddAddress($to);
            $mail->Subject = $subject;
            $mail->IsHTML(true);
            $mail->Body = $message;
            $mail->Send();

Debug output

in outout we are getting email is sent

@Synchro
Copy link
Member

Synchro commented Apr 12, 2024

This makes no sense. Your subject line string already has other spaces in, and whether they come from the name or the literal text makes no difference.

First of all double check what you're actually receiving:

 var_dump($_POST['name']);

Then try these combinations to find out where it's going wrong:

$subject = 'Hello Ravi a! Welcome to  Habits!';

$name = 'Ravi a';
$subject = 'Hello '.$name.'! Welcome to  Habits!';

$subject = $_POST['name'];

@RaviWeb105
Copy link
Author

This makes no sense. Your subject line string already has other spaces in, and whether they come from the name or the literal text makes no difference.

First of all double check what you're actually receiving:

 var_dump($_POST['name']);

Then try these combinations to find out where it's going wrong:

$subject = 'Hello Ravi a! Welcome to  Habits!';

$name = 'Ravi a';
$subject = 'Hello '.$name.'! Welcome to  Habits!';

$subject = $_POST['name'];

with $subject = 'Hello Ravi a! Welcome to Habits!';

the emails are not sending

@Synchro
Copy link
Member

Synchro commented Apr 12, 2024

Define what you mean by "not sending"; show the debug output with $mail->SMTPDebug = 2.

@RaviWeb105
Copy link
Author

RaviWeb105 commented Apr 16, 2024

Define what you mean by "not sending"; show the debug output with $mail->SMTPDebug = 2.

2024-04-16 10:32:23 SERVER -> CLIENT: 220-p3plzcpnl445408.prod.phx3.secureserver.net ESMTP Exim 4.96.2 #2 Tue, 16 Apr
2024 03:32:23 -0700 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
2024-04-16 10:32:23 CLIENT -> SERVER: EHLO apis.journyapps.com
2024-04-16 10:32:23 SERVER -> CLIENT: 250-p3plzcpnl445408.prod.phx3.secureserver.net Hello apis.journyapps.com [208.109.22.165]250-SIZE 52428800250-8BITMIME250-PIPELINING250-PIPECONNECT250-AUTH PLAIN LOGIN250 HELP
2024-04-16 10:32:23 CLIENT -> SERVER: AUTH LOGIN
2024-04-16 10:32:23 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2024-04-16 10:32:23 CLIENT -> SERVER: [credentials hidden]
2024-04-16 10:32:23 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2024-04-16 10:32:23 CLIENT -> SERVER: [credentials hidden]
2024-04-16 10:32:23 SERVER -> CLIENT: 235 Authentication succeeded
2024-04-16 10:32:23 CLIENT -> SERVER: MAIL FROM:<admin@journyapps.com>
2024-04-16 10:32:23 SERVER -> CLIENT: 250 OK
2024-04-16 10:32:23 CLIENT -> SERVER: RCPT TO:<web105@moontechnolabs.com>
2024-04-16 10:32:23 SERVER -> CLIENT: 250 Accepted
2024-04-16 10:32:23 CLIENT -> SERVER: DATA
2024-04-16 10:32:23 SERVER -> CLIENT: 354 Enter message, ending with &quot;.&quot; on a line by itself
2024-04-16 10:32:23 CLIENT -> SERVER: Date: Tue, 16 Apr 2024 10:32:23 +0000
2024-04-16 10:32:23 CLIENT -> SERVER: To: web105@moontechnolabs.com
2024-04-16 10:32:23 CLIENT -> SERVER: From: Journy Apps <admin@journyapps.com>
2024-04-16 10:32:23 CLIENT -> SERVER: Subject: Hello Ravi Amrutiya this is for the test
2024-04-16 10:32:23 CLIENT -> SERVER: Message-ID: <lVheIX7WKUAQiQyAV5JZI9oYaptlTySbPLt2cpzSLcs@apis.journyapps.com>
2024-04-16 10:32:23 CLIENT -> SERVER: X-Mailer: PHPMailer 6.8.0 (https://github.com/PHPMailer/PHPMailer)
2024-04-16 10:32:23 CLIENT -> SERVER: MIME-Version: 1.0
2024-04-16 10:32:23 CLIENT -> SERVER: Content-Type: text/html; charset=iso-8859-1
2024-04-16 10:32:23 CLIENT -> SERVER: 
2024-04-16 10:32:23 CLIENT -> SERVER: demo
2024-04-16 10:32:23 CLIENT -> SERVER: 
2024-04-16 10:32:23 CLIENT -> SERVER: .
2024-04-16 10:32:28 SERVER -> CLIENT: 250 OK id=1rwg6x-008SCc-2g
2024-04-16 10:32:28 CLIENT -> SERVER: QUIT
2024-04-16 10:32:28 SERVER -> CLIENT: 221 p3plzcpnl445408.prod.phx3.secureserver.net closing connection
{"success":"1","message":"Mail sent successfully!"}

@Synchro
Copy link
Member

Synchro commented Apr 16, 2024

This shows an entirely successful send. It also reveals that you're using GoDaddy, which is never a good thing, and you're also using an old version of PHPMailer.

@RaviWeb105
Copy link
Author

It also reveals that you're using GoDaddy,
->ya it is used by our client we can't do anything in that.

"This shows an entirely successful send"
->but still we are not receiving the emails

and you're also using an old version of PHPMailer.
->which is the new version nad you mean in new version this is resolved?

@Synchro
Copy link
Member

Synchro commented Apr 16, 2024

Not receiving and not sending are entirely different problems. PHPMailer is responsible only for sending, and here you have shown that it is working fine; Your submission to GoDaddy's server is successful. What happens to the message after that is nothing to do with PHPMailer, but you should expect to receive bounces if onward delivery from there fails. If you don't receive anything, it's GoDaddy's mail servers that are at fault, which is nothing unusual. Alternatively, check your spam folder.

It's not "resolved" in the new version, because there is nothing to resolve, but you should always be running latest versions.

@Synchro Synchro closed this as completed Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants