Jump to content

Recommended Posts

I have a page on my website that sends out a simple html email.

  • This page worked a few days ago.
  • Then last night when I was showing my client, it worked, but the email did not display properly (html code was visible in the email).
  • Then today I can not get it to work at all.

I have not changed my code, and I am using a script that I have used a lot of times. I'm not familiar with all the php settings on a server. I assume that one of these settings below are conflicting with each other.

 

 

mail.add_x_header -- on

mail.force_extra_parameters -- no value

mail.log -- no value

sendmail_from -- no value

sendmail_path -- /usr/sbin/sendmail -t -i

MAILTO -- root

 

Also I had a similar problem a week ago. The email was not being sent out, then I played around with it, but did not actually change anything and it started to work again.

Edited by PeggyBuckham
Link to comment
https://forums.phpfreaks.com/topic/269316-mailto-function-not-working/
Share on other sites

Some times the mailqueue can be messed up. On this server, do you control the mail server? It returns TRUE because it was accepted by the mail system, whether it was sent out is upto the mail server.

 

One thing to try is specify the "from" as from a valid email on the domain, or something like "no-reply@domain.com" and see if that helps.

Yea, do you know what mailserver you are using? (postfix exim ... ?) That would help if you still cannot get it working. And as this is more than likely a server configuration issue, I moved it appropriately.

Edited by premiso

So I actually have to places where the code i wrote sends out an email. One of them already had the "from" from noreply@mysite.com. This morning I tested the sytem and it was working for both email. I had them sent to two diffrent email addresses each (4 emails). ...the system worked this morning, but it does not work now. I allso noticed that the emails being sent to my personal email were displaying the html code/tags. I am going to see what happens if I send out emails that are not htmls. This smight be a clue.

So i do not understant mail servers: POP3, SMTP etc.. I got the emails to work by taking out the html code. This is not a solution. It is a work around. For the moment I am going to let it go becouse I did not have any complecated emails to send out on this site.

Thank You premiso, for your help! I am not going to mark this as solved, but I am going to move on to other work

are you using something like PHPmailer :confused:

 

<?php
require("class.phpmailer.php");
$mail = new PHPMailer();$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp1.example.com;smtp2.example.com";
$mail->SMTPAuth = true;
$mail->Username = 'smtpusername';
$mail->Password = 'smtppassword';
$mail->From="mailer@example.com";
$mail->FromName="My site's mailer";
$mail->Sender="mailer@example.com";
$mail->AddReplyTo("replies@example.com", "Replies for my site");
$mail->AddAddress("email@example.com");
$mail->Subject = "Test 1";
$mail->IsHTML(true);
$mail->Body = "<h1>Test 1 of PHPMailer html</h1><p>This is a test</p>";
$mail->AltBody="This is text only alternative body.";
if(!$mail->Send())
{
  echo "Error sending: " . $mail->ErrorInfo;;
}
else
{
  echo "Letter is sent";
}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.