using third party smtp - php

I run a website that allows users to send email newsletters using their SMTP, not the host's SMTP. In that case the user can connect directly with his/smtp to send email. I am aware that some hosting companies do not allow this. Does anyone know the way around this? I need to move my website from the present host.

You can use SwiftMailer (http://swiftmailer.org/). The user would need to give you there login information, but then you can login to their email account and send the emails from their account. This will work all the time since the host can't tell if it's a standard mail client trying to send email. You can even send through a gmail account.
If that's not what you want, then you are probably referring to relaying, which you can just give up on. Open relay has been one of the biggest security holes on mail servers for over a decade. Nobody should have that issue anymore.

Related

Should SMTP be used for contact forms?

I understand SMTP is often used to send mail to client addresses, because the host may be considered spam and blocked. In this case, suppose I have a website with a few contact forms, that sends an email to the administrator's email account (eg. gmail). Because the email is sent to the admin, does SMTP have any benefits in reliability or security? Additionally, if the host sends email directly, does the host server need an 'email account'?
There is nothing particularly wrong with this approach. Many large frameworks and CMS systems use email as a way of contacting the admins for internal messages (software updates needed) or for contact form submissions from users.
If your framework has built-in API calls for transactional mailers, check those out - eg: Laravel recommends a couple of mail providers that already have API calls baked into the framework.
If you are using pure PHP, I can strongly recommend the excellent PHPMailer library over the built-in mail() function - PHPMailer is far easier to set up for SMTP.
The admin will need an account to send mail from, but if this is purely for site -> admin communication you can use the same gmail account for both the sending and receiving.
Note about gmail:
If you are going to use a gmail account to send, the account needs to have access for less secure apps enabled. You will also need to ensure that you don't annoy the Google admins with the volume of mail. Things like spam detection can be ignored since all the mail is going to one account and that account can simply whitelist the sending address.
Note about SMTP:
SMTP is generally secure enough for this sort of thing, as long as you use SMTP over SSL/TLS. Do not send mail to an SMTP server unencrypted as the password will also travel unencrypted and your account will be hacked quickly. Do not use port 25.

Codeigniter emails not being received by gmail

I have an app where i'm sending emails on certain events, but when i used my gmail account, i never receive the emails and they are not in my spam folder. When i send them to my work email, i receive them instantaneously.
What do i need to do to get the emails through to google?
I'm using the standard codeigniter email configs (which i think uses sendmail).
I'm using google apps for business and i have the MX records setup that google provides.
Do i need anything else? Also, i'm using subdomains in my app, does that affect what i may need to setup?
EDIT
When i use smtp like this example Sending email with gmail smtp with codeigniter email library, the page never seems to come back. It eventually just timesout.
The only plausible explanation for this behaviour is a SPF Check failure. SPF or Sender Policy Framework is a new technology that allows easy detection of spam. Gmail honours SPF unless you manually mark those emails as not spam. Regardless of this, if you have received emails on another address then they must have reached Gmail too. Check your spam thoroughly, as Gmail does not discard emails even on very high spam suspicion rather they end up in the Spam folder.
You can set up a SPF that allows your webserver to send emails which will result in Gmail accepting emails sent by your webserver as authentic. See http://www.mydigitallife.info/how-to-set-up-and-create-sender-policy-framework-spf-domain-dns-txt-record-with-wizard/ and a wizard from Microsoft.
You will probably see, that at some point in the future, you'll get them all appearing in Gmail. Google is most likely seeing if the sender is spam, and holding those messages. I've experienced that before setting up dev servers. I would suggest using a transactional email service, like Mandrill or SendGrid. You'll find you get a lot of info from those services that you forgo if you simply send an email through PHP.
The Filter Theory The other possibility is that the poster has a filter set up on their GMail account that is filtering out the emails.
I would make sure that you are sending the required header information as well. Have you tried registering a new gmail account and sending it to that user?

Gmail and PHP MAIL function

I have a small problem that i cannot for the life of me seem to solve. I have a php script which takes some user data and processes it and sends an email to admin and an email to the user with an activation key. This is all fine and dandy, but the problem is GMAIL accounts. The user gets the email no problem but if it is a GMAIL account there is no mail in the inbox or spam box. Just wondering anyone might have any solutions.
moved from my comment:
so across the board, NO gmail accounts get your email? Maybe your host is blacklisted, and your mail is just flat out banned? Is your server blacklisted? Have you checked? Also what is your /var/log/ mail queue result? Does gmail accept the mail?
Some tools, check if you were blacklisted here:
http://www.mxtoolbox.com/blacklists.aspx
http://whatismyipaddress.com/blacklist-check
Some more info on getting un-blacklisted: http://www.isipp.com/resources/am-i-blacklisted/
Be aware that sometimes it may take awhile to get de-listed, I had one
server act up, and was blocked by hotmail, for a few months even after
all places removed my ip.
Consider using some SMTP php implementation, which can reveal possible problem.It will contact gmail servers directly without passing them to MTA.
Also note that gmail uses SSL enalbed SMTP servers on port 465 or 587.
On other way, take a look at this : http://www.richardlord.net/blog/php-mail-and-gmail

How to get the Reply Emails ? Need a Mail Server?

As i'm knowing just about PHP and don't know at all about Mail Servers, what i want to know here is:
How can i get the "Replied" emails (from the receivers) for the mails i've send (by using PHP, with a address like xxxxxxx#gmail.com)
Does it need to setup my own Mail Server?
Unless using own Mail Server, is there any other easy way?
Honestly i'm not well understanding over IMAP or Email Protocols. Doing setup my own IMAP Server is far worse. Can it be done simply with a Web Hosting which supporting IMAP protocol? Or do i need to setup manually out from the start?
To be brief, i need a simple guide.
You only need a mail server if you don't already have a place where those reply-tos end up. Which adress are you sending them as? Where would you fetch the emails for those adress? You can ask PHP to log into any mail server that you'd fetch your emails from manually as well, so there shouldn't be a problem. But maybe I'm not getting you right.
Simply put the reply address to an email you own. For the example you gave to work, you would need to have the xxxx#gmail.com account.
Most people use something along the lines of mailer#youdomain.com, ans then create an account for that on their ma8lserver.
If you want to use your own domain, you don't need to run your own mailserver. Gmail, hotmail, and others have services that let you use their mailservers for your fomain, for free.

PHP sending emails through random email accounts

I'm working on a website that allows you to send emails without registering, and without specifying a sender. You enter the recipient's address, subject, body and send. My problem is sending the message. What I'm trying to achieve:
User clicked send -> Subject,recipient,body sent to PHP -> Server validates the information -> Server creates a random email account -> Server sends the email through the random account created -> Server deletes the account
I'm stuck at the random email account creation step. How do I achieve this with PHP without having to pay for my own SMTP server and without having to use my own gmail/hotmail account.
I googl'd the hell out of this issue and I can't find an answer.
Thanks!
BTW
I'm using Apache to "host" on my own Ubuntu
How do I achieve this with PHP without having to pay for my own SMTP server and without having to use my own gmail/hotmail account.
The way to create E-Mail accounts varies wildly from server software to server software, and is usually not possible from within PHP.
Depending on your server's configuration, though, that might not be necessary: If you set up a catch all address for a domain, many server configurations will allow you to send out mails from any E-Mail on that domain (e.g. 123456789#example.com). Any responses will then go to that catch-all mailbox, the contents of which you will probably want to discard.
You have to realize, though, that this is exactly how spam providers operate. Extreme caution is advised if you don't want to end up on all sorts of spam blacklists.
I don't believe you can create accounts or email accounts on a server, using PHP, as this supersedes PHP's permission level. Sending emails this way is a good way to get your server banned, FYI. Also, if you insist on sending emails like this, why not just specify a dummy From: email address? It would essentially be the same thing as creating a dummy account anyhow.
You may also want to use the -f switch, for PHP's mail(). See php.net/manual/en/function.mail.php

Categories