Jump to content

Recommended Posts

Hi everyone,

 

I've got some free web space that gives me email accounts and sendmail enabled (apparently), but I'm a bit confused.

 

I can use any email name before my domain name that I choose, and the email account is catch-all so whatever the name, it goes to my webmail page in my vista panel. So basically it's not set up for any individual email address, just anything + domain name. I understand that, but trying to send myself an email from my hotmail account results in a delivery failure notification in hotmail. Any idea why that might be? (The people I've got the hosting from have closed down their help boards and everything over Xmas...still not back online or answering tickets.)

 

The next thing is the sendmail. I've tried a basic contact form on my site directing emails to my hotmail account, but it doesn't send anything. I've since checked PHP info and as well as safe mode being on (which I think means sending emails to any address is not possible?), it has this:

 

sendmail_path     /usr/sbin/sendmail mail@*mydomainname*.com

sendmail_from    no value

SMTP    localhost

smtp_port    25

 

Now I don't understand the sendmail_path despite looking in up in the PHP guide. I can only think it means that any contact form on the website is only allowed to send emails to the address put in the sendmail_path? If that's a correct assumption, do I put that path into the mail($to...) part of my contact form?

 

Just not understanding how it all works at the moment, would really appreciate any guidance.

 

Thanks a lot,

James

Link to comment
https://forums.phpfreaks.com/topic/83623-solved-contact-form-not-sending-emails/
Share on other sites

When I searched through the forum to see if anything similar had been asked that might help me, most similar questions were in the PHP Help section, so I assumed it was the right section as considered by others. Where else would you recommend?

 

And yes, I would have thought it related to PHP since the settings are in php.ini, and the code for the mail() function is a PHP function... Please elaborate if you still think that is incorrect, by all means.

I'm not entirely sure what you're asking.  Let's see if the system can send a simple email using php.  Try this:

 

$from = "email@domain.com";
$to = "email@domain.com";
$subject = "testing email";
$headers = "From: $from \r\n";
$message = "test email";
$headers .= "Content-Type: text/plain; charset=UTF-8; format=flowed\n".
            "MIME-Version: 1.0\n".
            "Content-Transfer-Encoding: 8bit\n".
            "X-Mailer: PHP\n";

$mailSucceed = @mail($to, $subject, $message, $headers);

 

Let me know if it works.

It does work. Thank you.

 

Thing is, the To: line has the email address twice, like this: To: james@here.com, james@here.com

 

It seems that it doesn't like Hotmail... contact form won't send to it and Hotmail doesn't receive emails from the contact form (they bounce back to Hotmail). Tried with GMail and it not only sends emails to my free host email account, but I can direct the form code you gave me to send to my GMail account and it does.

 

Incidentally, what is the difference between mail() and @mail()? I tried googling it, but it ignores @ symbols.

 

Thanks again for helping me.

James

dont put it in a loop or it will send more then one email ok...

 

@ <<< means ignore any errors....

 

<?php
$to = 'bob@barnyard.com';
$subject = 'Wakeup bob!';
$message = '<b>yo</b>, whassup?';
$headers = "From: server@barnyard.com\r\n" .
        'X-Mailer: PHP/' . phpversion() . "\r\n" .
        "MIME-Version: 1.0\r\n" .
        "Content-Type: text/html; charset=utf-8\r\n" .
        "Content-Transfer-Encoding: 8bit\r\n\r\n";

// Send
if(mail($to, $subject, $message, $headers)){
echo "mail sent to $to";
}else{
echo "no mail sent sorry email $to agin";
}
?>

 

code rewritten ok......

I've got some free web space that gives me email accounts and sendmail enabled (apparently), but I'm a bit confused.

 

I don't think $4 is a lot for a month's worth of web hosting - if you get a good host they will give you access to stuff like this for free. You also get no ads (maybe you don't have ads either), but more importantly it is somthing that is trustworthy and not a crap shot like anything for free is. Take my advice and pay those few lousy dollars. - Oh and if you are afraid of "credit card theft" go get yourself a debit card from Walgreens. I'm 16 years old and use that to pay off my hosting bill. HOpe that helps!

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.