WebFaction
Community site: login faq
0
1

When sending a mail using SMTP via a PHP script, why doesn't the mail get saved in the Sent folder (of roundcube) in the mailbox ?

asked 27 Feb '13, 06:21

epqrs
16921433
accept rate: 0%


Because a raw SMTP send does not contain the info to save to the mailbox, it only sends the message. Saving to someplace else is something the e-mail client does. You would have to write code which also said to save the message to the sent folder of your mailbox using IMAP.

permanent link

answered 27 Feb '13, 20:02

johns
5.4k412
accept rate: 23%

$transport = Swift_SmtpTransport::newInstance('smtp.webfaction.com')->setUsername('username')->setPassword('password');
What is the method to send an email via imap ? $transport = Swift_SmtpTransport::newInstance('imap.webfaction.com')->setUsername('username')->setPassword('password');

(28 Feb '13, 05:23) epqrs

You'll need to use two different tools for what you want to accomplish:

  • You need to use a SMTP library to send the outgoing messages via smtp.webfaction.com
  • You need to use a IMAP library to connect to mail.webfaction.com to store a copy of the message in your "Sent" folder.

There's an example of the IMAP operation available here: PHP, IMAP -> on send save to INBOX.Sent

Another way to accomplish this would be to BCC yourself on the sent messages, then use a procmail rule to move the BCC'd message to your Sent folder when it arrives in your inbox. There are example of how to filter mail with procmail in our documentation: Automatically Filtering Email

Hope that helps!

permanent link

answered 01 Mar '13, 12:33

seanf
12.2k42136
accept rate: 37%

The documentation of your mailing library 'Swift Smtp' will have to be consulted for how to do it using that library, I looked and don't think it is supported. A lower level function to do this would be imap_mail_move or imap_mail_copy you could add this to your code to copy the message as it is being sent or after its sent.

permanent link

answered 28 Feb '13, 17:31

johns
5.4k412
accept rate: 23%

But according to the doca @ http://docs.webfaction.com/user-guide/email_clients/other.html#other-mail-clients - IMAP (for receiving) — mail.webfaction.com. It does not mention IMAP for sending.

(01 Mar '13, 01:42) epqrs
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×70

question asked: 27 Feb '13, 06:21

question was seen: 9,944 times

last updated: 01 Mar '13, 12:33

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM