I am pulling email into my app via imap using Net::IMAP and copying the mail into an All Mail folder then marking it in inbox as deleted.
This then enables a backup of all emails for the user in All email folder and my app only pulls in emails from the inbox not flagged as deleted.
This works fine for gmail but i am trying to do it for horde webmail.
I successfully pull in the emails but cant seem to flag them as deleted and copy them to another folder.
Here is my code for doing this in gmail :
imap.uid_copy(uid, "[Gmail]/All Mail")
imap.uid_store(uid, "+FLAGS", [:Deleted])
Any one help with this? What should the "[Gmail]/All Mail") be changed to for horde webmail? Is this different for all email like hotmail / yahoo etc?
Any help on this would be great.
thanks
rick
can you try this?
connection.store( uid , "+FLAGS", [:DELETED])
...
connection.expunge()
e.g. "store" instead of "uid_store" ?
I'm not using Horde, but the above line is working for me for several IMAP servers.
Also make sure that you call connection.expunge on the mailbox where you flagged the messages for deletion..!
e.g. look at the net/imap API for #expunge:
http://www.ruby-doc.org/stdlib/libdoc/net/imap/rdoc/classes/Net/IMAP.html#M001441
Related
I send a email with sendGrid Api V3.
When a receive email from web. It work format
But when i open mail with default app on iphone. It wrong format:
I use Sendgrid Api v3 to send mail. Pls Someone can help me solve this error...
It looks like you lost formatting... it almost seems like you're looking at the text version. I would recommend testing the email in something like Litmus, which will let you see the email on different platforms.
Also try looking at the email in different clients (Gmail, Outlook, etc), and see if maybe you're just sending a text version only.
I really like this gem https://github.com/ryanb/letter_opener
When you're in local development, it will open the email in a browser window when it sends, so you can actually see what you're sending as well.
is there any possibility to check with the ActionMailer mail function if a mail-address is still alive?
My problem is that I have a ruby on rails application with lots of users, but some of those changed their mail address and now I got lots of mails back. It would be cool If I can check if the mail is still present, and if not I delete the user from Database.
Any Ideas for this problem?
If you're sending mail and it fails, you can view those if you've configured
raise_delivery_errors = true
That would go in your config/environment/development or production.rb
Sadly though, with raise_delivery_errors there's a gotcha:
This only works if the external email server is configured
for immediate delivery.
If you have the option to use something like mailchimp, sendgrid, etc it handles most of this for you - it won't send to bogus emails, it silences them on future mailings and is just a convenient way to manage your email clickthroughs, etc. Some email services give you a webhook that says "this email bounced" which you can then do something with in your app/database. Or more primitively, you can download a csv periodically from their portal and update the database.
i have a problem with mail sending: magento doesn't send any mail, i'm trying to use the sendfriend functionality (i've extendend the ProductController of that Sendfriend module), but the problem is about any email (i've tried to do a registration or to change a password, but no email was sent). backend settings seems to be ok:
System->Configuration->system->Mail sending settings->disable Email Communications->No;
System->Configuration->system->Mail sending settings->Host ->locahost;
with the same settings on another local magento installation the system send emails correctly. what can i check?
you don't need to do any coding stuff. Its already available in Magento. You just need to enable the option of Email to a friend from the back-end. Hope this help you.
When using 'mail' command to send email to a gmail user, the email goes through fine. When sending an email using a Rails app, the email is sent to the spam folder for the gmail user. Can someone help me think through this?
Emails landing in SPAM can happen due to many reasons:
Wrong Mail Server setup: Checkout here on how to setup
Email content: Content of the email can also invite SPAM. Sites like SpamCheck helps to check whether the content of the email is ok.
As mentioned by #Noli above, using services like Sendgrid, Critsend etc for sending out emails, chances of landing them in Inbox will be more. You can use them as relay servers from Postfix. But the first two steps are anyway necessary.
Use Mailchimp if you want to sent emails to many people, for eg: for sending out newsletters, marketing emails etc.
Mail deliverabillty is extraordinarily hard to get right. You should consider leaving this to the specialists like Sendgrid or Mailchimp, and not spend tooooo much development time thinking about it
Another thing to check is that if this is a new server, you may need to set up Domain Keys to authenticate to Gmail. This happend to me and I was able to get my mail removed from the spam folder by following these:
https://help.ubuntu.com/community/Postfix/DomainKeys
https://help.ubuntu.com/community/Postfix/DKIM
I have application that needs to send emails and sms text messages. It sends emails just fine, but when I try to send text messages using email gateways (for verizon, xxxyyyzzzz#vtext.com) I get nothing. I have texted the phone using though the email gateway using my gmail account, so I know it works. I would just think that from my app's point of view I am just sending out another email. Any idea why this doesn't work? Or what I can do to troubleshoot it?
I should also note that I am doing this from a Rails app on my local computer...not that it should matter.
Maybe Verizon has software that can identify emails sent from software rather than humans, and rejects yours?
Try making your software add all the same headers (eg. X-Mailer) that a normal email client would add.
Verizon could be doing a reverse DNS query as a simple spam check. Your ISP's info could show up during this look up instead of the return address info that your email message contains, and thus could be getting blocked.
To troubleshot this make sure that the return e-mail address that you are using is coming from an ISP e-mail account.
Here is how to debug it on Linux. Run your Rails application server with strace:
strace -s99999 -e connect,read,write,close -o strace.log script/server
Then examine strace.log and see exactly which SMTP server the Rails application connects to, and what it reads and writes.
Then do the same with your favorite mail client (recommended: mutt, because Thunderbird is slow in strace).
Try to send exactly the same bytes from Rails what your mail client sends.
I have used SMS_Fu in the past to send out text messages. It has worked wonderfully.
I have written a client app for Ruby for sending SMS, please see http://freebiesms.blogspot.com/2009/07/send-free-sms-from-ruby.html to download
complete source code.
Regards
Dan