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

  • SEARCH
  • Home
  • 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 6629137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:13:03+00:00 2026-05-25T22:13:03+00:00

I am sending html email to the client via php mail function. while &

  • 0

I am sending html email to the client via php mail function. while & sign shown in bold creating problems in email replacing ! %20 something like characters within my ids such as below(in bold).

http://test.com/test-page.php?id=abcd**!**1234&cat_id=23

Below is my code.
$to = ‘test@abc.com’;

// subject
$subject = 'test';

//message
 $message.='<html><head><meta charset="UTF-8" /></head><body><p><a href="http://test.com/test-page.php?id=abcd1234&cat_id=23" target="_blank">Wine **&** Dine Offers</a></p></body></html>';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";

// Additional headers
$headers .= 'To: test <test@abc.com>' . "\r\n";
$headers .= 'From: test user <no-reply@test.com>' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers); 

After sending mail i am getting ! and %20 like characters in email.
I also tried & except & in email but no use still ! adding within my email html.

  • 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-05-25T22:13:04+00:00Added an answer on May 25, 2026 at 10:13 pm

    I changed the encoding settings on phpmailer to use base64 encoding using

    $mail->Encoding=”base64”

    This solved my problem.

    As there is issue for HTML mail meassage exceeds length 998 or something i got the above solution to it. 🙂

    http://www.jeremytunnell.com/posts/really-hairy-problem-with-seemingly-random-crlf-and-spaces-inserted-in-emails

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am sending an email via php/html to a gmail address. The email displays
Is there a better way to generate HTML email in C# (for sending via
Having some trouble sending properly formatted HTML e-mail from a PHP script. I am
I'm trying to accomplish the following, I'm sending a HTML email using PHP Mailer
I'm building a template for an HTML email I'll being sending via .NET. I
Possible Duplicate: Sending HTML email from PHP Using PHP to send an email. I
I am sending html emails through php . the email has a background image
I'm using the PHP native mail() function to send HTML emails and have a
I am sending a normal html email message to people using PHP of which
I am sending email through gmail, i want to send some html content, is

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.