Sending email from one local email account to another on Thunderbird - php

Currently trying to do the following but was unable to do so:
Set up 2 accounts on Mercury using XAMPP.
Install Thunderbird and add both accounts as POP3 accounts.
Sending using the Thunderbird client from one user to another works fine.
However, using testsend.php does not work for me and produces an error:
Warning: mail(): SMTP server response: 553 We do not relay non-local mail, sorry. in C:\xampp\htdocs\email\testsend.php on line 17
testsend.php
<!DOCTYPE html>
<html>
<body>
<h1>Hello mail</h1>
<p>My first m</p>
<?php
$to = 'user#local';
$subject = 'Email';
$message = 'Test';
$headers = 'From: userb#local' . "\r\n" .
'Reply-To: userb#local' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers, '-user#localhost');
echo 'sent successfully!';
?>
</body>
</html>
I've received the warning, and after some googling, I did this:
Unticking the box.
Afterward, I rerun the file; this time, there were no warnings or errors. However, no emails appeared in my Thunderbird client for both users.
Any possible solutions to this? Thank you!

Related

I needed to make a script that sends emails seen as another person [duplicate]

I have a PHP Contact form on a site I am hosing on our mediatemple grid server that was made with Rapidweaver. It works well except that the email it generates to our info#ourdomain.com is sent as serveradmin#ourdomain.com. I think the server is just using the trash/blackhole address. Any way to adjust my php or better yet, the server settings, to send the mail as the reply-to address that the user fills out on the contact form itself?
Why? Well Google hosts the email for this domain and I wanted to use their canned responses as an auto-responder. The problem of course, is that the auto-response goes to serveradmin#ourdomain.com and not the user's email address that he filled in on the form.
Thank you for the help!
-Hunter
You can add headers to your mail
<?php
$to = 'nobody#example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster#example.com' . "\r\n" .
'Reply-To: webmaster#example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
see mail phpdoc

PHP mail() fails to send email, no page errors. SMTP

Below is a basic block of code that should send an email upon someone landing on the page. When I visit the page, I get zero errors, however the email never arrives in my inbox. Any help would be appreciated, as I feel it has something to do with my SMTP server being remote.
ini_set('SMTP','myServer');
ini_set('smtp_port',25);
If (isset($_GET["email"])) {
$email = $_GET['email'];
$to = 'group1#myOrg.org';
$subject='Internal Password scam';
$message = "$email clicked on the link and landed on the page.";
$headers = 'From: donotreply#myOrg.org' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
Some other information-
server: win64 2008 R2 Ent (Sp1)
For my particular problem it had nothing to do with the code. The issue had to deal with permissions set on the account that the emails were being sent to. My personal email wasn't allow to receive this type of email, the netadmin's email account used as $to and the emails went through just fine.

php mailer is not working hotmail

<?php
$to = 'xyz#hotmail.com';
$subject = 'the subject';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers = 'From: acb#gmail.com' . "\r\n" .
'Reply-To: acb#gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$message = 'hi hello';
mail($to, $subject, $message, $headers);
echo 'mail sent';
?>
As I am sending mail using above code .. it is working fine ..
but mails are not going to hot mail...
can anyone help me in this please
This can be a plethora of things. One of the more common ones is that you are telling them you are sending mail from a gmail account but are not actually connecting to them from a gmail server.
If you could provide us with more information (specifically, lines concerning delivery from your mail.log) we could help better but most likely it is either that you aren't allowed to send mail for gmail and/or that your server is marked as "bad" by hotmail.
The hotmail spam filter stopped it, and with good reason. Advise i can give you:
Send it to yourself, and see the raw message. You may find that the From: address has changed and differs form the Reply-To:. To avoid that, send the email via SMTP instead.
If the domain you send from has a SPF DNS record, that may help. Spam filters use this to look up the authenticity of emails that claim to come from a certain domain.
This is why the #gmail.com address you used is certainly not going to pass through..

Send multiple emails using PHP

I working on a project in which i need to develop a functionality to send multiple emails to client with one click and i am adding customer id in one text box separating them with comma.
Please tell me how to do this problematically. Your advice
<?php
$to = 'nobody#example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster#example.com' . "\r\n" .
'Reply-To: webmaster#example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
if you want to send the user as in db jus replace the $to address from db and place these code in loop.
php.net's mail function page explains this well
to be fair we all had to start somewhere. The problem with using "vanilla PHP mail" is that it is almost always used when people send mail as spam. So for 10 years mail servers haven't liked it. There are ways round it but to be brief:
To send Email via a webpage you "should"
have your mail server resolve RDNS
try to avoid cheap/free web hotels as mailserver hosts
use PHP PEAR MAIL (this is tricky/odd to install)
properly apply the correct headers for the mail in PEAR
Check below link may be help you.
http://www.quackit.com/php/tutorial/php_mail.cfm

cannot send mail using php mail function

Im trying to use PHP mail on my local computer, but its just not working. I am using the standard script from the php website:
PHP error I'm getting
SMTP server response: 550 Error sending message: Error: FROM address is invalid
actual PHP
$to = 'nobody#example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster#example.com' . "\r\n" .
'Reply-To: webmaster#example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
i downloaded a local mail server, argosoft. it says the service URL is http://services.argosoft.com/RelayService/Service.asmx . I assume this is what i put in php.ini.
php ini.
For Win32 only.
SMTP = services.argosoft.com/RelayService/Service.asmx
smtp_port = 25
I have had this error before, and I believe all you have to do is change the email webmaster#example.com to a real email. Make sure you send it to a real email as well.
Replace #example.com with real email addresses.
and in PHP.ini set
SMTP = localhost
Apparently, a number of mail systems have trouble with the carriage return \r. You might want to modify your $header to use only the new line character \n. See if that works.
Also, you might want to try using the full From header:
From: Some Name Here <real_email#notAnExample.com>

Categories