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 7414793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:10:16+00:00 2026-05-29T07:10:16+00:00

As advised I have tried using PHP Mailer to send email attachments with a

  • 0

As advised I have tried using PHP Mailer to send email attachments with a form, however I keep getting the error message “Mailer Error: Could not instantiate mail function.

I have rechecked the email address and cannot find any error for same

here is the code for the PHP as well as the code for the form. Any input is greatly appreciated. Thanks, JB

<html>
<head>
<title>PHPMailer - Mail() basic test</title>
</head>
<body>

<?php

require_once('class.phpmailer.php');

$mail             = new PHPMailer(); // defaults to using php "mail()"

$body             = file_get_contents('talent3.html');
$body             = eregi_replace("[\]",'',$body);

$mail->AddReplyTo("jbgraphics@rogers.com","First Last");

$mail->SetFrom('jbgraphics@rogers.com', 'First Last');

$mail->AddReplyTo("jbgraphics@rogers.com","First Last");

$address = "jbgraphics@rogers.com";
$mail->AddAddress($address, "John Beadle");

$mail->Subject    = "PHPMailer Test Subject via mail(), basic";

$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; //     optional, comment out and test

$mail->MsgHTML($body);

$mail->AddAttachment("images/phpmailer.pdf");      // attachment
$mail->AddAttachment("images/phpmailer_mini.jpeg"); // attachment

if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

?>

</body>
</html>

and the form code:

<form action="test_mail_basic.php" method="post"
enctype="multipart/form-data">
<label for="file" class="bodyCopy"><span class="bodyCopy">Attach resume:</span></label><br     />
<input type="file" name="attach1" id="file" /><br /> 
<br />
<label for="file" class="bodyCopy"><span class="bodyCopy">Attach photo:</span></label><br />
<input type="file" name="attach2" id="file" /><br /> 
<br />
<input type="submit" name="submit" value="Submit" />
</form>
  • 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-29T07:10:17+00:00Added an answer on May 29, 2026 at 7:10 am

    That error is a result of the php mail() function returning false.

    Typically, it returns false if sendmail is not configured correctly in php.ini or if sendmail doesn’t exist on the server.

    Are you running this on a Linux server or Windows? A very simple test to see if mail is working is to run this code:

    <?php
    $to = 'you@yoursite.com';
    
    $res = mail($to, 'Testing mail', "This is a test\n\nEnd.", "From: $to");
    
    if ($res) {
        echo "Message appears to have been accepted"; // does not mean it will be delivered
    } else {
        echo "PHP mail() failed.";
    }
    

    If you are on Windows, you will likely need to use an SMTP server instead of php mail() so you will need to use SMTP as seen in this phpmailer SMTP example.

    If you are on shared hosting, it may be that the message is being rejected because of some of the extra parameters being send to the mail function.

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

Sidebar

Related Questions

i am trying to valdiate the date field YYYYMMDD using PHP regex. I tried
I have a PHP SOAP web service, using CakePHP, which is returning a variable
To trim the leading spaces we are using strmove. But we were advised to
I have tried uploading a transparent PNG image to a SQL server image field,
I am using jQuery to build an array of images from a php array.
Does anyone have know how I can step into system.web.mvc? I am getting an
I have tried to do this on my own but couldn't. I have an
I have written a simple server - client program with Swing interface using singleton
I have a COM+ application that I wrote using C#. I have the assembly
I am using PL/SQL Developer and i have written a procedure to run a

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.