My PHP script sending mail to all other mail perfectly, but not getting any mail in trustmedi.com. Ff I send mail from my gmail to dummy#trustmedi.com, it's working. I had already tried gmail smtp, PHPmailer but it's not working. My dummy.trustmedi.com is using gmail server.
from my previous post I have got following answer
The main reason is that your domain is listed on SORBS DUHL black list which says:
Additional Information: [Dynablock] Dynamic IP address, use your ISPs
mail server Listed but has active as exception(s) and therefore might
NOT be blocked.
166.62.27.124 is an active exception for the network 166.62.24.0/22.
166.62.27.151 is an active exception for the network 166.62.24.0/22.
Related
I am trying to send mail using PHP Mailer but there is an issue with setfrom() method
In $mail->setFrom('abcd#abcd.com', 'Jay');
When I use domain name .com mail gets sent and received properly
But when I use . co domain name example $mail->setFrom('abcd#abcd.co', 'Jay');
Its doesn't show any error and says mail sent successfully but mail isn't received on my account.Tried changing google privacy settings.
Note:Not using SMPT kept it to false using default settings
Update:Ok so the thing is It is working but the emails are being receive after hours and hours if I use .co but when I use .com email are received immediately.
Probably server problem.
This sounds like a known problem that's been answered before: gmail does not allow setting arbitrary from addresses. You can preconfigure aliases in settings, but you can't simply start using them at the sending client. You can see the submission conversation by setting $mail->SMTPDebug = 2;, but if it's sending successfully, PHPMailer has no involvement beyond that point.
Ok so the problem was the server (bluehost)
What was happening is whenever the setFrom() had an email address whose sub domain was not '.com' eg: " abcd#abcd.co,abcd#abcd.in" the mail was being received after several hours.
It would work normally if setfrom() was set to a normal address eg: a#gmail.com .
Probably a server issue.
I am using PHP's mail() function, but I am unable to send mails to the majority of servers.
It send mails to the GMAIL without problems...Probably the rest of servers simply deny my mails...I set the MX records of the mail servers that I need...And I changed my PTR record to mail.example.com......however stil cant send mails..How can I solve this problem?
In addition, messages' sender is displayed as "www-data#localhost"
(I am using Digital Ocean, Ubuntu 12.04)
Errors that I am getting in log file:
My unqualified host name (localhost) unknown; sleeping for retry localhost sendmail[11620]: unable to qualify my own domain name (localhost) -- using short name(errors that I get in mail.err); and in log file it shows some errors regarding verification, Do I need to install smt regarding STARTTLS=client
when using the mail() function ypou neet to set the SENDER as well as teh from/to etc.
i.e.
mail($to, $subject, $body, $headers, "-f ".$webmaster);
The important thing is that "-f ".$webmaster that allows you to override the default of 'www-data#localhost' as the BOUNCE address (Envelope sender) for failed mail..
Most mailers will reject e-mail with an invalid bounce address.
Many hosted servers will not let you set the -f value tho...it sets the 'real sender' and of course its a classic way to send spam..
Try with the -f and if it fails change your hosting company.
Or get yourself a virtual private server.
I had the same problem and one thing you can do is: open a ticket with digital ocean support. By default, new accounts have a block to send e-mails (to avoid spammers). They resolved quickly and greatly improved.
Another thing is: check your mail reputation. You can find some websites that can help with this, like mail-tester.com - This site provides a report with potencial issues to fix the problem.
i have sendmail set up on Ubuntu 12.10, Apache 2.2 and I can now successfully send emails from my local server using php mail() function. I just wanted to know how do i send mail to my server from gmail or perhaps just send mail to my local server from my local server...
I have tried finding my IP addess and sending a mail from my gmail account to somefakeid#myip and i dont seem to see any mail in /var/mail directory..
and by the way just confirming, any recieved mail will be stored in from of a text file in /var/mail whose name will be the username to which the mail was sent right?
i dont see any file named somefakeid...
Please help...
(Isn't there any PHP inbuilt function which checks for any received mail?)
You can use phpmailer class to connect to a remote or gmail server and than send email.
refer to the following link for more information: http://phpmailer.worxware.com/?pg=examplebgmail
You need couple of things, you need a domain and a mx record. when you have the domain you point your mx record to point to your IP and make sure port 25 is open to receive email.
I am trying to send out password reset links for when users forget their password to login to a system I am creating. The problem is, the smtp server is supposedly not configured on the server my system is hosted on. So whenever I try to use the php mail() function to send an email to an internal email address, the emails fail to send, but outside email address (tested with a gmail account), the emails go through. I believe this is because my server is sending directly out to the internet instead of passing through an internal smtp server to resolve where our domain emails should be sent. I was wondering if anyone knew how to configure this on an Xserve or if they knew how to specifically tell the php mail() function where to initially send the email. Any help or pointing in the right direction would be extremely helpful.
Thank you!
mail() doesn't send mail, it just hands things over to the local SMTP server. It does NOT reach out to the recipient's server to deliver the mail. In real world terms, mail() walks your letter down the street and drops it into the neighborhood mailbox. After that, it has absolutely nothing more to do with mail delivery.
Check your local SMTP server's logs to see why the local mails aren't being delivered. There should be a line or two saying why it's registered. Perhaps the local MTA (mail-transfer agent, aka the local "mail man") isn't configured properly.
You can control mail() with it's settings.
This might not solve your overall problem, but hopefully it's useful. This related answer has more information.
We just addressed this problem internally here. Hopefully this will help you as well.
Our environment:
Ubuntu 12.04 LTS
PHP 5.3.10
We could telnet into our SMTP server and send mail from our web server, so it wasn't a permissions issue. When attempting to mail externally, all works perfectly. When attempting to mail internally, silent failure.
Our PHP is using sendmail, which by default, attempts to relay mail to 127.0.0.1. Point this at your SMTP server by editing /etc/mail/sendmail.cf. Update the line from:
# "Smart" relay host (may be null)
DS
to
# "Smart" relay host (may be null)
DSyour.smtp.server.com
Restart sendmail and try sending yourself an email via PHP.
This is something that occurs on Parellels’ PLESK server administration software.
Find your ‘main.cf’ configuration file for PostFix, which for CentOS 6, is located at
/etc/postfix/main.cf
If you can’t find it, do a
which postfix
SSH command to at least see where Postfix is on your server.
Then, open the file up through a text editor, or in the Linux shell, and make these lines (should be at the end of the file, around line 677) :
virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
virtual_mailbox_maps = hash:/var/spool/postfix/plesk/vmailbox
commented out like this :
#virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
#virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
#virtual_mailbox_maps = hash:/var/spool/postfix/plesk/vmailbox
Then, restart the Postfix service
sudo service postfix restart
Apache while your at it (can’t hurt), and voila! Your email address should be receiving those emails now. This also doesn’t affect any of your regular emails or anything else, either.
On my localhost (Linux Mint OS) Swiftmailer is working fine with the following code, but whenever I move it up to my server is just hangs at the send function and then gives me an internal server error.
I currently have my email setup through Google Apps, so maybe SMTP will not work for this situation? If thats the case, how do you suggest I change this from SMTP.
Also, whenever I send an email like this, it is showing up with a from address of the one in the username area. I want it to show up with the from address in the "setFrom" function.
//Include the swiftmailer class
require_once 'comm/swiftmailer/swift_required.php';
//Create a message
//Pass it as a parameter when you create the message
$message = Swift_Message::newInstance();
$message->setSubject('My Subject');
$message->setFrom(array('noreply#domain.com' => 'No Reply'));
$message->setTo(array('me#domain.com' => 'Me'));
$message->setBody($emailContent, 'text/html');
//Create transport class and email the message
$transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, 'ssl')->setUsername('useracctname')->setPassword('password');
$mailer = Swift_Mailer::newInstance($transport);
$result = $mailer->send($message);
Thanks a lot for any help!
This might be a port problem on the server. Port 465 could be closed to prevent spamming. It could also be that the server's version of PHP lacks SSL support.
I am wondering though, could it be that I am not using the local mail server so it wont allow SMTP?
If you address gmail as explicitly as you do, it's very unlikely you're using another transport type or a different server.
Also, what about using one of the other transport types?
I think SMTP is your only option to get it running with Gmail. It could, however, be that your server is providing a mail() based service (obviously with a different sender address than GMail though). In that case, you may be able to use Swiftmailer's mail transport.
I had the same problem : I was able to send gmail email in local (after updating that configuration : https://www.google.com/settings/security/lesssecureapps ) but not in production.
To fix my problem I've logged to my gmail account with my production ip / from my production server and answer the gmail security question.
One of the solution to log to your gmail account with your production ip, is to
open an ssh tunnel (ssh -2NfCT -D 5000 yoursshuser#yourdomain.org)
configure you browser to use that proxy (eg Firefox :to Preferences > Advanced > Network > Settings > Manual proxy configuration > SOCKS Hosts: localhost / Post: 5000 / SOCKS v5 )
log to you gmail account as usual
The error outputed by Symfony was :
app.ERROR: Exception occurred while flushing email queue: Failed to authenticate on SMTP server with username "joe.doe" using 1 possible authenticators [] []
well, here is the solution.
if you are sending SMTP mail you should create email account at the server then use this email info at your code.
the server will not send the email if you don't have valid email account to send using it
when you use "from".
this should be a true correct email account a fake one.
the only possible reason to send using fake account is using mail() function.